|
Yes, I am calling CoInitialize(NULL) before CoCreateInstance() API.
hr = CoCreateInstance() retunrs -2147024809, not 0.This is what I am replying
to you. Please help me how to handle this problem.
|
|
|
|
|
-2147024809 == 0x80070057 == E_INVALIDARG == Invalid Argument.
Post some code to see how you are calling CoCreateInstance.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
#include "..\\NTServiceDLLOne\\NTServiceDLLOne.h" //Headers for IDllNtServiceCOM
#include "..\\NTServiceDLLOne\\NTServiceDLLOne_i.c" //For CLSID_and IID
CoInitialize(NULL);//Initialize COM Library
IDllNtServiceCOM* ppInterface = NULL; //COM Dll Interface Pointer
HRESULT hr = CoCreateInstance(CLSID_DllNtServiceCOM, NULL, CLSCTX_INPROC_SERVER, IID_IDllNtServiceCOM, (LPVOID*)ppInterface);
BSTR bstring = L"Hello World";
LPUNKNOWN punk = NULL;
hr = ppInterface->ShowMessageBox(bstring, &punk); //
hr = ppInterface->Release(); //Releasing interface pointer
CoUninitialize(); //Uninitialize COM Library
_Module.Start();
|
|
|
|
|
ppInterface is an interface pointer. You need to pass a pointer to the pointer so that CoCreateInstance can load a value in it.
Instead of:
IDllNtServiceCOM* ppInterface = NULL;
HRESULT hr = CoCreateInstance(CLSID_DllNtServiceCOM, NULL,
CLSCTX_INPROC_SERVER, IID_IDllNtServiceCOM, (LPVOID*)ppInterface);
It should be:
IDllNtServiceCOM* pInterface = NULL;
HRESULT hr = CoCreateInstance(CLSID_DllNtServiceCOM, NULL,
CLSCTX_INPROC_SERVER, IID_IDllNtServiceCOM, (LPVOID*)&pInterface);
if (SUCCEEDED(hr))
{
}
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Hi all,
I have a quick question which I hope someone can help me solve easily. I have a legacy system to maintain which combines WinBatch (a windows scripting language) and Visual C++ 6 applications.
We have a WinBatch script which starts up our Visual C++ appliactions. These apps then create global sections of memory, mutex objects etc. The app then later kicks off another WinBatch script. Seems pretty simple...
The problem we are facing is that the script that is kicked off by the application inherits the process space of the parent application that called it. i.e. it has in its address space handles to the global sections of memory etc that belong to the parent etc. This causes us some grief later down the track.
My question is that is there a way to spawn off a sub process in VC++ 6 that does not inherit from the parent? The system was originally coded using the win32api system call, and I have also tried the _spawnl call, but to no effect.
Hopefully I have just missed something really obvious here.
Many thanks,
Tony.
|
|
|
|
|
|
Have you ever had one of those moments where you slap yourself in the head an say
"Of course...DOH!!!"
Thank you very much. Your suggestion worked a treat.
Cheers,
Tony.
|
|
|
|
|
Tony Valiantis wrote:
Have you ever had one of those moments where you slap yourself in the head an say
"Of course...DOH!!!"
You mean that could be the cause of my permanent headache? Of course... DOH!!!
Glad to be of help.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
I developed a Visual C++ (MFC) with MS Visual Studio .NET 2003, but encountered the following linking errors when compiling for realease build. However, it was compiled successfully in debug configuration.
mfcs71.lib(stdafx.obj) : error LNK2001: unresolved external symbol ___security_cookie
atls.lib(atlbase.obj) : error LNK2001: unresolved external symbol ___security_cookie
ConnectSock.obj : error LNK2019: unresolved external symbol ___security_cookie referenced in function "unsigned int __stdcall ATL::_AtlGetThreadACPFake(void)" (?_AtlGetThreadACPFake@ATL@@YGIXZ)
DBOperation.obj : error LNK2001: unresolved external symbol ___security_cookie
MainFrm.obj : error LNK2001: unresolved external symbol ___security_cookie
stdafx.obj : error LNK2001: unresolved external symbol ___security_cookie
mfcs71.lib(stdafx.obj) : error LNK2001: unresolved external symbol @__security_check_cookie@4
atls.lib(atlbase.obj) : error LNK2001: unresolved external symbol @__security_check_cookie@4
ConnectSock.obj : error LNK2019: unresolved external symbol @__security_check_cookie@4 referenced in function "unsigned int __stdcall ATL::_AtlGetThreadACPFake(void)" (?_AtlGetThreadACPFake@ATL@@YGIXZ)
DBOperation.obj : error LNK2001: unresolved external symbol @__security_check_cookie@4
MainFrm.obj : error LNK2001: unresolved external symbol @__security_check_cookie@4
stdafx.obj : error LNK2001: unresolved external symbol @__security_check_cookie@4
stdafx.obj : error LNK2019: unresolved external symbol __imp___resetstkoflw referenced in function "bool __cdecl ATL::_ATL_SAFE_ALLOCA_IMPL::_AtlVerifyStackAvailable(unsigned long)" (?_AtlVerifyStackAvailable@_ATL_SAFE_ALLOCA_IMPL@ATL@@YA_NK@Z)
mfcs71.lib(stdafx.obj) : error LNK2001: unresolved external symbol __imp___resetstkoflw
mfcs71.lib(stdafx.obj) : error LNK2019: unresolved external symbol __SEH_epilog referenced in function "bool __cdecl ATL::_ATL_SAFE_ALLOCA_IMPL::_AtlVerifyStackAvailable(unsigned long)" (?_AtlVerifyStackAvailable@_ATL_SAFE_ALLOCA_IMPL@ATL@@YA_NK@Z)
atls.lib(atlbase.obj) : error LNK2001: unresolved external symbol __SEH_epilog
mfcs71.lib(stdafx.obj) : error LNK2019: unresolved external symbol __SEH_prolog referenced in function "bool __cdecl ATL::_ATL_SAFE_ALLOCA_IMPL::_AtlVerifyStackAvailable(unsigned long)" (?_AtlVerifyStackAvailable@_ATL_SAFE_ALLOCA_IMPL@ATL@@YA_NK@Z)
atls.lib(atlbase.obj) : error LNK2001: unresolved external symbol __SEH_prolog
I have tried to manipulate some of the linking properties for the release configuration but still could not get it working. Could someone help me out on this? Thank you very much.
|
|
|
|
|
|
Hi JLR,
Thanks a bunch for your information. I have solved the problem. Thanks!
|
|
|
|
|
I developed a Visual C++ (MFC) with MS Visual Studio .NET 2003, but encountered the following linking errors when compiling for realease build. However, it was compiled successfully in debug configuration. I have tried to manipulate some of the linking properties for the release configuration but still could not get it working. Could someone help me out on this? Thank you very much.
|
|
|
|
|
I have a server_client program and it was use in MS Dos. But how can I use this server_client program in a Dialog that I had designed.
|
|
|
|
|
|
I mean I already designed a dialog to send message through IP address. And I try to do my test on sending message using MS Dos. After that I don't know how to apply into the dialog that I designed.
|
|
|
|
|
You might try using ShellExecute to 'open' the DOS program that you want to use to send the message...
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
The program is layed out as follows:
(Program 1 :: EXE) -- This I cannot modify
+Contains a form which creates child windows
+Sends HWNDs of child windows to DLL to attach to.
(Program 2 :: DLL) -- This I am writing
Main Thread:
+Starts Graphics Thread, waits for return
+ Posts Message to Graphics Thread to create it's windows
+ Posts Message to Graphics Thread to subclass it's windows
Graphics Thread:
+ Creates instances of each window (each are OpenGL classes wrapped in a CWnd)
for(unsigned short i = 0; i < NUMWIN; i++)
{
pGraphicsWin[i] = new COpenGLWin ( i );
}
+ Subclass Window to the received HWND.
BOOL worked = pGraphicsWin[i]->SubclassWindow( hwnd );
+Do appropriate other stuff
Ok, my problem is as follows:
While the subclass window appears to work correctly (though I doubt it really is), when I try to access the device context ( i.e. this.GetDC() ) of one of the graphics windows, it fails.
I believe this is due to the fact that subclassing is process specific, and therefore you cannot subclass a window which is not running in the same process as your application.
Therefore, I have read up on CBT hooks, however, I can't seem to figure out where to set the hook. Also, I read that only one hook is necessary per thread, not per window, but I am confused as to how that would work!
Appreciate your help, I'm stumped!
|
|
|
|
|
hello
i work in network when we use the X25 protocole to comunicate and i want to make an application to download files from others PCs of the network,and i have no idea how to do that,are there someone who can help me ?
|
|
|
|
|
Surely you must have some kind of API to work with, and which comes with a manual. If you can, you can always use the connection oriented part of X.25, and then it's not much different from TCP/IP. I think. It's been a while since I did X.25. I read about it in the datacom courses at the university, and I briefly came in touch with it for a telecom application I wrote 6, almost 7 years ago.
Good music: In my rosary[^]
|
|
|
|
|
how do u create a dc over ur whole dialog window and allow a user to draw lines on it?
help would be appreciated
thx
|
|
|
|
|
Override the CDialog::OnPaint()
Unless you really mean the WHOLE window in which case use GetWindowDC()
It's frustrating being a genius and living the life of a moron!!!
|
|
|
|
|
ok, thx. now how do u allow the user to draw on it?
|
|
|
|
|
You could create a custom control that handled the drawing and then insert the control in the dialog.
To enable drawing you need to handle mouse messages (button down, mouse move, button up, etc.) and draw in the window accordingly.
You can look at Microsoft's scribble sample program to get ideas on how to do it. There are Win32 and .NET versions for this sample, and although they are intended as MFC tutorials, you can still use it to extract useful ideas.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
i dont understand why i cant get the text from an editbox of a window
its a window that was created durring runtime
i tryed GetWindowText on a handle to the edit box but it outputs a bank char array
is it somehow different for getting text from editboxes that are created during runtime?
im pretty sure that the dialog window is created during runtime but i may be mistaken because its not my program that creates it
help would be very appreciated
thx
|
|
|
|
|
Sample code please
Here is a piece of my code :
<br />
CEdit searchedit;<br />
CString srchstrl;<br />
searchedit.GetWindowText(srchstrl);
Remember the text is not returned, it is placed in the CString refrence.
Elaine
The tigress is here
|
|
|
|