Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
W

whiteclouds

@whiteclouds
About
Posts
105
Topics
36
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to make IO Manager call my AddDevice routine in my driver?
    W whiteclouds

    Hi all! I am a new guy for driver development. I had written a drive to implement a virtual disk through file. The DriverEntry routine is as below:

    NTSTATUS DriverEntry(PDRIVER_OBJECT drvObject, PUNICODE_STRING usRegPath)
    {
    PKEY_VALUE_PARTIAL_INFORMATION startKeyValue;
    ULONG version;
    int i;

    Dump("DriverEntry " DRIVER\_NAME " " DRIVER\_VERSION "\\n");
    
    memset(&OsVersion, 0, sizeof(RTL\_OSVERSIONINFOW));
    OsVersion.dwOSVersionInfoSize = sizeof(RTL\_OSVERSIONINFOW);
    RtlGetVersion(&OsVersion);
    //Dump("RtlGetVersion:%d,%d\\r\\n", OsVersion.dwMajorVersion, OsVersion.dwMinorVersion);
    // Load dump filter if the main driver is already loaded
    if (NT\_SUCCESS (FDDeviceIoControl (NT\_ROOT\_PREFIX, FD\_IOCTL\_GET\_DRIVER\_VERSION, NULL, 0, &version, sizeof (version))))
    	return DumpFilterEntry ((PFILTER\_EXTENSION) drvObject, (PFILTER\_INITIALIZATION\_DATA) usRegPath);
    
    FDDriverObject = drvObject;
    memset(VirtualVolumeDeviceObjects, 0, sizeof(VirtualVolumeDeviceObjects));
    
    if(NT\_SUCCESS(FDReadRegistryKey(usRegPath, L"Start", &startKeyValue)))
    {
    	if(startKeyValue->Type == REG\_DWORD && \*((uint32 \*)startKeyValue->Data) == SERVICE\_BOOT\_START)
    	{
    		LoadBootArguments();
    	}
    	FDfree(startKeyValue);
    }
    else
    {
    	Dump("Read registry key value failure!\\n");
    }
    
    VolumeClassFilterRegistered = IsVolumeClassFilterRegistered();
    ReportBOOL("VolumeClassFilterRegistered", VolumeClassFilterRegistered);
    
    for (i = 0; i <= IRP\_MJ\_MAXIMUM\_FUNCTION; ++i)
    {
    	FDDriverObject->MajorFunction\[i\] = FDDispatchQueueIRP;
    }
    FDDriverObject->DriverExtension->AddDevice = FileDiskAddDevice;
    
    drvObject->DriverUnload = UnloadDriver;
    
    return FDCreateRootDeviceObject(FDDriverObject);
    

    }

    In the code above, I had register a AddDevice routine named FileDiskAddDevice. Through the message output by DebugPrint, I look my driver can be loaded successfully by system. Next, I want to make IO manager call my AddDevice routine. But I don't know how to do it. My driver is just for a virtual device. No real device fits it. So I can't add device by unplug and plug again. I hope someone can be kind to tell me what I should do. Thank you! :) Be regards!

    There is some white cloud floating on the blue sky. That's the landscape I like.

    Hardware & Devices windows-admin hosting cloud tutorial question

  • How to build my own service?
    W whiteclouds

    Hi all! I am studying the development of windows service. I wrote a demo project as the memstatus written by Mr.Yevgeny Menaker. But when I start it, SCM tell me that an error occurred during start period. And the service can't be paused and stopped although I had set the accepted code as SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN. I am a new one about windows service. So I don't know how to fix it. I hope someone could be kind to help me. Thx! :)

    There is some white cloud floating on the blue sky. That's the landscape I like.

    ATL / WTL / STL help hosting cloud tutorial question

  • How to install the USB driver in silent?
    W whiteclouds

    Hi All! I am developing a project to install a driver for USB with InnoSetup. Now I had copied all files needed to the appropriate directories such as system32\drivers, system32\ etc. And I had write the appropriate registry keys to register the driver. But after installed, when the device was plugged in, the system say it can't find .sys file and .dll file. I must locate them by myself, although they had been copied successfully. I don't know how to fix it. Is there someone be kind to help me? Thx! Best Regards!

    There is some white cloud floating on the blue sky. That's the landscape I like.

    Hardware & Devices help windows-admin hosting cloud tutorial

  • How to get the address of resource data in an execute file?
    W whiteclouds

    Thank you very much!

    There is some white cloud floating on the blue sky. That's the landscape I like.

    ATL / WTL / STL hosting cloud tutorial question learning

  • How to get the address of resource data in an execute file?
    W whiteclouds

    Hi all! I am trying to change the resource data in an EXE file for some reasons. Before I do that, I must get the address of it. But I don't know how to get it. I read some documents of PE. Now I can get the address of IMAGE_RESOURCE_DIRECTORY. Then I open a my-own EXE to do so. In this EXE, I had added a resource specified by myself. Now I try to change it. In resource-directory structure, the value of RVA of that data is 55E18h. But I can't get the correct address from this RVA. The base address of IMAGE_RESOURCE_DIRECTORY is 4E600h in my EXE. If I add the RVA to the base address, the result address is beyond the file. The correct address of data is 4F418h. I don't know how to get it. Is there somebody be kind to tell me the method? Thx!

    There is some white cloud floating on the blue sky. That's the landscape I like.

    ATL / WTL / STL hosting cloud tutorial question learning

  • Problem of OLE Object
    W whiteclouds

    Hi All! I am developing an OLE Object for MS-WORD. Now I meet a problem. And I hope someone can help me. The Object I developing can be added into a .doc file. After added, it will draw a shape such as rectangle or circle etc. as the proof of existence. Now I find that when the .doc file which had been added the Object is to be loaded, the shape will be drawn twice. And the position of these shapes are different. I don't know why this occurred. During the time I try to fix it, I noticed that the call of "CComControlBase::InPlaceActivate" is very important. Only after I call it, the loaded object can work. I think this means that one of the two shapes I see is owned by "InPlaceActivate". The other is owned of "UIActivate". But I can't find anyway to make this object is "InPlaceActivated" or "UIActivated" only. Is there anyone could be kind to tell me the correct way to fix this problem? Thank you! Best regards!

    There is some white cloud floating on the blue sky. That's the landscape I like.

    ATL / WTL / STL help com hosting cloud question

  • Where can I get the OLE specification?
    W whiteclouds

    Thank you very much!

    There is some white cloud floating on the blue sky. That's the landscape I like.

    ATL / WTL / STL com hosting cloud question

  • Where can I get the OLE specification?
    W whiteclouds

    Hi all! Now I am developing an application which will use many technology about OLE. But I know little about it. I often meet the problems. When I seek the answer in MSDN, I notice that a document named 'OLE specification' is often be referenced. I try to find it. But nothing can be found through google. Is here somebody know it? If somebody know, I hope you could be kind to tell me the web-link of it, or send it to me by email. Thank you! Best regards!

    There is some white cloud floating on the blue sky. That's the landscape I like.

    ATL / WTL / STL com hosting cloud question

  • May be bad code or May not be!!!
    W whiteclouds

    Funny! I think if you want this code work as your meaning, you should override the operator "==", or you convey it into other language such as C#.

    There is some white cloud floating on the blue sky. That's the landscape I like.

    The Weird and The Wonderful help

  • How to create an OLE control in EXCEL sheet?
    W whiteclouds

    Hi, barneyman. I had fixed this problem. The reason of problem is that I missed a procedure. The right step is: 1. Get a pointer of OLEFormat with calling Shape.get_OLEFormat() 2. Get a pointer of _OLEObject with calling OLEFormat.get_Object() 3. Get a pointer of Dispatch with calling _OLEObject.get_Object() 4. Convert the Dispatch to my own object's pointer. Thank you for waste your time to help me. I hope I could get more help from you later! Good luck!

    There is some white cloud floating on the blue sky. That's the landscape I like.

    COM com help tutorial question

  • How to create an OLE control in EXCEL sheet?
    W whiteclouds

    Sorry, maybe I make you nervous. That's my fault. :) 1. Nothing output when I call OLEObjects.Add. Maybe it's because I call the Dispatch.Invoke() to add. The reason of I call Dispatch.Invoke() instead of OLEObjects.Add() is that an error of 0x800A03EC always occurred for OLEObjects.Add(). 2. I can't get the meaning of your second suggestion. You tell me to query OLEObjects at the object Shapes.AddObject returned? 3. Your meaning is that I should query some container interfaces such as IOleContainer for the object returned by Shapes.AddOLEObject(), isn't it? Why? By the way, the error of 0x800A03EC isn't means wrong cultureinfo. The correct meaning is that another operation background is executed on the same object. I must make the object such as button lost focus. This is a bug for Office 2003. :) Following is the explanation from Microsoft: http://support.microsoft.com/kb/823988/en-us[^][] I had try to do as the code provided by Microsoft. But nothing changed. I hope you can help me in advance. Thank you!

    There is some white cloud floating on the blue sky. That's the landscape I like.

    COM com help tutorial question

  • How to create an OLE control in EXCEL sheet?
    W whiteclouds

    The message I get tell me that I should call _WorkSheet.OLEObjects() to get an OLEObjects, then call OLEObjects.Add() to insert my own object. But I get an error whose code is 0x800A03EC. This means I should set the right CultureInfo before calling OLEObjects.Add(). But I can't find any hint to set it besides using .NET framework. Should I using .NET just for this? I had try to call GetSystemDefaultLCID() and ConvertDefaultLocale() to fix it. But the same error occurred. What shall I do?

    There is some white cloud floating on the blue sky. That's the landscape I like.

    COM com help tutorial question

  • How to create an OLE control in EXCEL sheet?
    W whiteclouds

    Pleasure to see your reply. Thank you very much! Some days ago, I find a message at MSDN. It said that if you want to add an OLE object into Excel worksheet, you should call OLEObjects.Add(), not Shapes.AddOLEObject(), because Shapes encapsulate the OLEObject returned by AddOLEObject. So the next operation such as OLEFormat.get_Object() can't get the raw point of the object inserted. I had tried the way it recommend. But I can't get a OLEObjects from worksheet. I find that the reason of failure is the wrong LANGID parameter. I am trying to find the right parameter for it now. If you can't be success from the code above, you can try to do by this way. And if you know what parameter of LANGID is right, I will be very pleased to know it from you. :-D Sincerely

    There is some white cloud floating on the blue sky. That's the landscape I like.

    COM com help tutorial question

  • How to create an OLE control in EXCEL sheet?
    W whiteclouds

    I had make clear that the reason of problem is the interface I need i can't be queried. When the following code executed, nothing output.

    HRESULT hr=pObj.QueryInterface(&cpCASign);

    But i don't know how to fix it. Pls help me. Thx!

    There is some white cloud floating on the blue sky. That's the landscape I like.

    COM com help tutorial question

  • How to create an OLE control in EXCEL sheet?
    W whiteclouds

    I had add _ATL_DEBUG_QI define in my project. Then message below is output:

    CComClassFactory - IUnknown
    CComClassFactory - IClassFactory2 - failed
    CComClassFactory - IClassFactory
    CCASign - IDispatch
    CCASign - IConnectionPointContainer
    CCASign - IProvideClassInfo
    CCASign - IConnectionPointContainer
    CCASign - IProvideClassInfo
    CCASign - IOleObject
    CCASign - IOleControl
    CCASign - {049948D1-5686-11CF-8E0D-00AA00A74C5C} - failed
    CCASign - IPersistStreamInit
    CCASign - IConnectionPointContainer
    CCASign - IProvideClassInfo
    CCASign - IOleContainer - failed
    CCASign - IDataObject
    CCASign - IPersistPropertyBag - failed
    CCASign - IRunnableObject - failed
    ATL: IDataObjectImpl::QueryGetData not implemented.
    _CrtDbgReport: String too long or IO ErrorCCASign - IRunnableObject - failed
    CCASign - {049948D1-5686-11CF-8E0D-00AA00A74C5C} - failed
    CCASign - {049948D1-5686-11CF-8E0D-00AA00A74C5C} - failed
    CCASign - IRunnableObject - failed
    ATL: IDataObjectImpl::QueryGetData not implemented.
    _CrtDbgReport: String too long or IO ErrorCCASign - IRunnableObject - failed
    CCASign - IPersistStreamInit

    These message are output when calling Shapes.AddOleObject. I check the interface marked as fail. Such interfaces are not needed to implement except "{049948D1-5686-11CF-8E0D-00AA00A74C5C}". I don't know what interface is "{049948D1-5686-11CF-8E0D-00AA00A74C5C}". My own interface is registered already. And its CLSID isn't {049948D1-5686-11CF-8E0D-00AA00A74C5C}. Is this the reason of problem?

    There is some white cloud floating on the blue sky. That's the landscape I like.

    COM com help tutorial question

  • How to create an OLE control in EXCEL sheet?
    W whiteclouds

    My control is written in C++. I had read the article you recommand. My control's ThreadModel is Single-Threaded apartment. I had tried the other key-word. Only "Apartment" and "Both" can work. I think maybe I hadn't implement some methods, so the conversion is failure. I hope you can list all methods I must implement. Thank you!

    There is some white cloud floating on the blue sky. That's the landscape I like.

    COM com help tutorial question

  • How to create an OLE control in EXCEL sheet?
    W whiteclouds

    Problem still exist. The value of hr is "E_NOINTERFACE". I feel very strange that the same operation can completed within Word. I check the interface declaration of CCASign many times. No mistake was found. Please continue to help me! Thank you!

    There is some white cloud floating on the blue sky. That's the landscape I like.

    COM com help tutorial question

  • How to create an OLE control in EXCEL sheet?
    W whiteclouds

    Hi, all! I had met a problem when I developing an addin for Excel. I want to create a new OLE control which developed by myself into Excel sheet. But an error occurred when I add it. I had try to do this by two ways. One is to call the method "Add" of the class "OLEObjects". Another is to call the method "AddOLEObject" of the class "Shapes". Both are all failure. When I call OLEObject.Add, an exception was throwed which said a com_error occured in Excel. The code I used is as below:

    CComPtr<MSEXCEL::\_Workbook> spBook;
    HRESULT hr = m\_spAppExcel->get\_ActiveWorkbook(&spBook);
    if(spBook == NULL)
    {
    	return;
    }
    CComPtr<MSEXCEL::Sheets> spSheets;
    spBook->get\_Sheets(&spSheets);
    CComPtr<MSEXCEL::OLEObjects> spObjs;
    CComVariant vtIndex(1);
    spSheets->get\_Item(vtIndex,(IDispatch\*\*)&spObjs);
    VARIANT vtResult;
    VariantInit(&vtResult);
    CComVariant ClassType(\_MYPROGID);
    CComVariant vtFalse(VARIANT\_FALSE);
    CComVariant left,top;
    int x,y;
    GetInsertPosX(x,y);
    left=x; top = y;
    CComVariant vEmpty(DISP\_E\_PARAMNOTFOUND, VT\_ERROR);
    CComPtr<MSEXCEL::\_OLEObject> pObj;
    try
    {
    	pObj = spObjs->Add(ClassType,vEmpty,vtFalse,vtFalse,vEmpty,vEmpty,vEmpty,left,top,g\_iCtrlInitWidth,g\_iCtrlInitHeight);
    	if(pObj == 0)
    	{
    		//Failure
    		return;
    	}
    }
    catch(...)
    {
    	DWORD dwError = GetLastError();
    	TCHAR info\[10\];
    	wnsprintf(info,10,L"%x",dwError);
    	MessageBox(NULL,info,L"Error",MB\_OK);
    	return;
    }
    

    When I call Shapes.AddOLEObject, the calling is success. But the value it returned can't be converted to the pointer I need. The code is as below:

    CComPtr<MSEXCEL::\_Workbook> spBook;
    HRESULT hr = m\_spAppExcel->get\_ActiveWorkbook(&spBook);
    if(spBook == NULL)
    {
    	return;
    }
    CComPtr<MSEXCEL::\_Worksheet> spSheet;
    spBook->get\_ActiveSheet((IDispatch\*\*)&spSheet);
    CComPtr<MSEXCEL::Shapes> spShapes;
    spSheet->get\_Shapes(&spShapes);
    ATLASSERT(spShapes);
    VARIANT vtResult;
    VariantInit(&vtResult);
    CComVariant ClassType(\_MYPROGID);
    CComVariant vtFalse(VARIANT\_FALSE);
    CComVariant left,top;
    int x,y;
    GetInsertPosX(x,y);
    left=x; top = y;
    CComVariant vEmpty(DISP\_E\_PARAMNOTFOUND, VT\_ERROR);
    CComPtr<MSEXCEL::Shape> spCtrl;
    spCtrl = spShapes->AddOLEObject(ClassType,vEmpty,vEmpty,vtFalse,vEmpty,0,vEmpty,left,top,g\_iCtrlInitWidth,g\_iCtrlInitHeight);
    if(spCtrl == 0)
    {
    	//Failure
    	return;
    }
    CComPtr<MSEXCEL::OLEFormat>spOleForm
    
    COM com help tutorial question

  • Why more than one picture added into .doc file can't be seen but single can? [modified]
    W whiteclouds

    Hi all! I am developing an add-in for Word 2003. It can insert a bitmap into .doc file after some operations by user. Question: When I insert only one BMP into .doc file, the picture can display correctly. If more than one BMP inserted, the picture can't displayed after save and re-open. I research this problem and find that the method named "InPlaceActivate" is called while only one BMP inserted. If more BMPs are inserted, this method can't be called. I am not sure which interface owned this method. So I research the interfaces be queried in both scenery. The different between them is that the interface as "IID_IOleXXX" will be queried if I add only one BMP. If I add more BMP into .doc file, those interfaces as "IID_IOleXXX" aren't be queried. Then the BMP can't be displayed. I think this is the reason. I try to resolve it by many ways. But all failed. Is there anybody could be kind to help me? Thank you! Best regards!

    There is some white cloud floating on the blue sky. That's the landscape I like.

    modified on Tuesday, March 29, 2011 4:06 AM

    ATL / WTL / STL help question graphics hosting cloud

  • Don't steal Computers from people that know how to use Computers..
    W whiteclouds

    The sentence in your signature is great! I want to copy it into my computer. Do you agree with me? :-D

    There is some white cloud floating on the blue sky. That's the landscape I like.

    The Lounge com tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups