i am using some JNI code and talking to a MFC extension DLL
I am using Visual Studio 6 . I get a crash when i try to create a window in one of the exposed functions . The crash seems to be in afxwin1.inl line 19 after the call to CreateEx
CHiddenWindow hiddenWnd ; <br />
extern"C"int APIENTRY<br />
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)<br />
// Remove this if you use lpReserved<br />
if (dwReason == DLL_PROCESS_ATTACH)<br />
TRACE0("DLLWRAPPER.DLL Initializing!\n");<br />
// Extension DLL one-time initialization<br />if (!AfxInitExtensionModule(DllWrapperDLL, hInstance))<br />
// Insert this DLL into the resource chain<br />// NOTE: If this Extension DLL is being implicitly linked to by<br />// an MFC Regular DLL (such as an ActiveX Control)<br />// instead of an MFC application, then you will want to<br />// remove this line from DllMain and put it in a separate<br />// function exported from this Extension DLL. The Regular DLL<br />// that uses this Extension DLL should then explicitly call that<br />// function to initialize this Extension DLL. Otherwise,<br />// the CDynLinkLibrary object will not be attached to the<br />// Regular DLL's resource chain, and serious problems will<br />// result.<br />new CDynLinkLibrary(DllWrapperDLL);<br />
elseif (dwReason == DLL_PROCESS_DETACH)<br />
TRACE0("DLLWRAPPER.DLL Terminating!\n");<br />
// Terminate the library before destructors are called<br />
return1; // ok<br />
JNIEXPORT jint JNICALL Java_Blah1<br />
(JNIEnv *pEnv, jclass)<br />
hiddenWnd.CreateEx(0 ,::AfxRegisterWndClass( NULL) , NULL , WS_OVERLAPPED , CRect(10,10,10,10),NULL , 0);<br />
I have a .ocx file that I am trying to install on many computers. I have found code in MSDN which shows how to register ActiveX in Visual 6.0 C++. http://msdn2.microsoft.com/en-us/library/ms177531.aspx[^] I successfully put this code into my application so before my program starts up it checks the registry to see if the activeX is installed and if it is not then it will copy the file to the C:\ and install it. This is working for admins only right now.
I copy it to the C:\ and not the system32 folder because the user that is logged on may not have admin rights to do so.
My problem is installing ActiveX will not work if the user doesn't have admin rights. I have tried with my program and using "regsvr32.exe C:\my.ocx" which returns and error stating "DllRegisterServer in C:\my.ocx failed. Return code was: 0x8002801c".
I know there is a function where I can run a batch file as another user (like an admin user) but I dont have a global admins userid and password.
Is there anyway to register an ActiveX with a less privileged user?
Since I didn't want to use MFC after reading all the tutorials on here for minimizing an application to the system tray, I did some research and made it so my program has a tray icon. Now, my only problem is, how do you detect when a window's minimize button is pressed in Win32? I've scoured MSDN and asked on a few forums, but nobody seems to be willing to give a direct answer.
The debugger doesn't seem to want to work. I might have to try a different IDE and see if it will make the compiler build the file with debugging info. When trying to get the debugger to work, this warning started to come up and it is now coming up all the time when I build my project.
<quote>Project : Win32 Application
Compiler : GNU GCC Compiler (called directly)
Directory : C:\Documents and Settings\John\Desktop\derp\
Switching to target: default
main.cpp: In function `int WinMain(HINSTANCE__*, HINSTANCE__*, CHAR*, int)':
main.cpp:57: warning: passing NULL used for non-pointer converting 1 of `HWND__* CreateWindowExA(DWORD, const CHAR*, const CHAR*, DWORD, int, int, int, int, HWND__*, HMENU__*, HINSTANCE__*, void*)'
Linking executable: C:\Documents and Settings\John\Desktop\derp\Win32GUI.exe
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 1 warnings
This is the code it is pointing to:
hWnd = CreateWindowEx(NULL,<br />
"WindowClass1", // name of the window class<br />"Our First Windowed Program", // title of the window<br />
WS_OVERLAPPEDWINDOW, // window style<br />300, // x-position of the window<br />300, // y-position of the window<br />500, // width of the window<br />400, // height of the window<br />
NULL, // we have no parent window, NULL<br />
NULL, // we aren't using menus, NULL<br />
hInstance, // application handle<br />
NULL); // used with multiple windows, NULL
The last NULL in the list is the line the compiler points to. Could this warning have an affect on the program not detecting when I click the icon?
If the compiler says "undeclared identifier" it means it can't find it. There are two possibilities:
1. A missing header file.
2. The identifies name is wrong or it's in a namespace and you haven't qualified the name with it or put in a using statement to import it.
Knock number two on the head by adding no_namespace after the #import. i.e.
#import "Voodoo.tlb" no_namespace
This tells the compiler not to use namespaces.
Last Visit: 31-Dec-99 18:00 Last Update: 3-Oct-23 15:16