|
Christian Graus wrote: I'm not sure why
Maybe his garbage collector hasn't run yet... be patient.
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
I had to write my question somewhere because I can not see any Java- forum...
It was more natural to write here than in e.g. html-forum because Java is a programming language too.
Where can I ask about Java? Please tell me?
beganovic_swe
|
|
|
|
|
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 />
<br />
extern "C" int APIENTRY<br />
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)<br />
{<br />
UNREFERENCED_PARAMETER(lpReserved);<br />
<br />
if (dwReason == DLL_PROCESS_ATTACH)<br />
{<br />
TRACE0("DLLWRAPPER.DLL Initializing!\n");<br />
<br />
if (!AfxInitExtensionModule(DllWrapperDLL, hInstance))<br />
return 0;<br />
<br />
new CDynLinkLibrary(DllWrapperDLL);<br />
<br />
}<br />
else if (dwReason == DLL_PROCESS_DETACH)<br />
{<br />
TRACE0("DLLWRAPPER.DLL Terminating!\n");<br />
AfxTermExtensionModule(DllWrapperDLL);<br />
}<br />
<br />
<br />
<br />
<br />
<br />
return 1;
}<br />
<br />
JNIEXPORT jint JNICALL Java_Blah1<br />
(JNIEnv *pEnv, jclass)<br />
{<br />
..<br />
hiddenWnd.CreateEx(0 ,::AfxRegisterWndClass( NULL) , NULL , WS_OVERLAPPED , CRect(10,10,10,10),NULL , 0);<br />
..<br />
<br />
}
Any ideas on this ?
Engineering is the effort !
-- modified at 14:23 Wednesday 12th July, 2006
|
|
|
|
|
Well you likely do not have the prerequisit envornment for creating a window since you are running in a Java Console Process! No WinMain no message queue etc.
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
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?
Thanks Chris
|
|
|
|
|
chris175 wrote: 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.
You aren't going to leave it this way, are you?
chris175 wrote: My problem is installing ActiveX will not work if the user doesn't have admin rights.
So can't you just assign those (rights) via AdjustTokenPrivileges() ?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
Apparently Vista will have this ability: clickety[^]
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
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.
|
|
|
|
|
See IsIconic() .
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I got it to work another way, but this is nice to know. Thanks.
Now I have another problem. Apparantly it doesn't respond to this:
[code]case WM_TRAYMESSAGE:
{
if(lParam == WM_LBUTTONDOWN)
{
ShowWindow(hWnd, SW_SHOWDEFAULT);
}
} break;[/code]
Any ideas?
|
|
|
|
|
slippnslide wrote: I got it to work another way...
What other way is there to check if a window is minimized?
slippnslide wrote: [code]case WM_TRAYMESSAGE:
Is this a User-Defined Message (UDM)? If so, where is it sent from? Without seeing the code in context, it's going to be near impossible to offer anything useful.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: What other way is there to check if a window is minimized?
I use this code:
case WM_SIZE:<br />
{<br />
if(wParam == SIZE_MINIMIZED)<br />
{<br />
ShowWindow(hWnd, SW_HIDE);<br />
}<br />
} break;
DavidCrow wrote: Is this a User-Defined Message (UDM)? If so, where is it sent from? Without seeing the code in context, it's going to be near impossible to offer anything useful.
Yes, it is. I was following various articles on here and tried various paramters for it. What I have it now at is this:
#define WM_TRAYMESSAGE (WM_USER + 1)
And this is the code I have for filling the structs for NOTIFYICONDATA:
nid.cbSize = sizeof(NOTIFYICONDATA);<br />
nid.hWnd = hWnd;<br />
nid.uID = 0;<br />
nid.uFlags = NIF_ICON | NIF_TIP;<br />
nid.uCallbackMessage = WM_TRAYMESSAGE;<br />
HICON hIco = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MYICON));<br />
nid.hIcon = hIco;<br />
strncpy( nid.szTip, "App name", 64 );<br />
<br />
ShowWindow(hWnd, nCmdShow);<br />
Shell_NotifyIcon(NIM_ADD, &nid);<br />
<br />
if(hIco) { DestroyIcon(hIco); }
If you need any more code, I'll post it for you.
|
|
|
|
|
So which of WM_TRAYMESSAGE or WM_LBUTTONDOWN are you not receiving?
slippnslide wrote: Shell_NotifyIcon(NIM_ADD, &nid);
What does this return?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: So which WM_TRAYMESSAGE or WM_LBUTTONDOWN are you not receiving?
That's what I'm not sure of. How would I test?
DavidCrow wrote: slippnslide wrote:
Shell_NotifyIcon(NIM_ADD, &nid);
What does this return?
Well, adding the tray icon works fine. The icon shows up and can be removed just fine.
|
|
|
|
|
slippnslide wrote: How would I test?
A breakpoint. The debugger.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
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
Compiling: main.cpp
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*)'
Compiling: Win32GUI.rc
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",
"Our First Windowed Program",
WS_OVERLAPPEDWINDOW,
300,
300,
500,
400,
NULL,
NULL,
hInstance,
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?
|
|
|
|
|
slippnslide wrote: 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?
I highly doubt it.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
how to avoid these error`s in my project...
error C2065: 'CLSID_Test' : undeclared identifier
error C2065: 'IID_ITest' : undeclared identifier
i have added respective _i.c file also then the following error is coming
fatal error C1010: unexpected end of file while looking for precompiled header directive
why..?
Thanks in before
james..
-- modified at 13:32 Wednesday 12th July, 2006
|
|
|
|
|
RockyJames wrote: how to avoid these error`s in my project...
error C2065: 'CLSID_Test' : undeclared identifier
error C2065: 'IID_ITest' : undeclared identifier
Without more information, I'd say a .h file was missing.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
i have added .h and .cpp ,i have added them from classwizard,by selecting respective tlb file..
|
|
|
|
|
RockyJames wrote: fatal error C1010: unexpected end of file while looking for precompiled header directive
doesn't that error usually mean you need to include stdafx.h??? Last modified: Wednesday, July 12, 2006 1:13:22 PM --
|
|
|
|
|
stdafx.h is included in the project..
|
|
|
|
|
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.
Steve
|
|
|
|
|
Is there any other way to use COM components in code without importing (#import) and server module (any compnent file like .tlb ). Can anybody suggest me a sample link for the same...?
-Malli...!
|
|
|
|