|
It was not to get the values in run time. I meant to view the values in status bar of the dialog editor.
- NS -
|
|
|
|
|
Yes you can chage the size and position
First of all you have to take the thatspecific window rect.
Use SetWindowPos() function to do this..
Bankey Khandelwal
Software Engineer
|
|
|
|
|
I am afraid you have mistaken.
We can see the size and position of selected control in the status bar, when we are in dialog editor. These are in DLU. I need to view them in real pixel scale. I think you got what I meant.
Thank you.
- NS -
|
|
|
|
|
|
i want in UNICODE exe Hook MessageBoxA and add some String, like:
MessageBoxA(NULL, "Hello", "Caption", 0); -> MessageBox(NULL, "Hello-Add", "Caption-Add", 0);
int WINAPI MyMessageBoxA(..lpszText, lpszCaption...)
{
...
strcat(lpszText, "-Add"); // <--- 1.
strcat(lpszCaption, "-Add"); // <--- 1.
MessageBoxA(...);
}
1.strcat and _mbscat, which function i need use?
|
|
|
|
|
well if you are hooking MessageBoxA in a UNICODE exe then it won't be called unless you specify MessageBoxA instead of MessageBox.
Anyways i think you can use strcat in MyMessageBoxA if it hooks the non unicode version of MessageBox AKA MessageBoxA
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
|
What is the need to hook MessageBoxA here? Simply calling it should do.
_tcscat should do it.
Nibu thomas
Software Developer
-- modified at 1:18 Friday 24th March, 2006
|
|
|
|
|
Did you read the post?
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
hi All
i am unable to find erase background event in Dialog
based application, ihave read somewhere that it's np
longer supported in vc 6++. Is there any alternative
as i have to make my dialog flicker free
|
|
|
|
|
what do you mean you can't find, its right there.
BEGIN_MESSAGE_MAP(CMydialog, CDialog)
....
ON_WM_ERASEBKGND()
END_MESSAGE_MAP()
then add function to mydialog.h file
BOOL OnEraseBkgnd(CDC* pDC);
and add the body to mydialog.cpp file
BOOL CMydialog::OnEraseBkgnd(CDC* pDC)
{
return TRUE;
}
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
Hello All,
I've a MFC application from which I've to call a routine from a DLL.
EARLIER, This DLL was getting used by a JAVA application.
But now there is a MFC application instead.
We dont' have to change the DLL code for this in any case.
The export routines have following declaration:
JNIEXPORT void JNICALL Java_gui_config_setManufacturer(JNIEnv *env, jobject obj);
Please let me know how this routine can be called from MFC application.
Thanks in advance!
Regards!
|
|
|
|
|
a1prashant@yahoo.com wrote: JNIEXPORT void JNICALL Java_gui_config_setManufacturer(JNIEnv *env, jobject obj);
Please let me know how this routine can be called from MFC application.
Did you try calling it?
Nibu thomas
Software Developer
|
|
|
|
|
Thank you for replying.
Issue1: (Is passing NULL, NULL correct??)
typedef void * (__stdcall *DLLPROC)(VOID *, VOID *);<br />
...<br />
DLLPROC pfnProc = (DLLPROC)GetProcAddress(hInst, "Java_gui_Win_getCurrFirmware");<br />
if( pfnProc )<br />
{<br />
AfxMessageBox("Got Java_gui_Win_getCurrFirmware");<br />
VOID * jstr = (pfnProc)(NULL, NULL);
AfxMessageBox("Called!");<br />
}
While calling the procedure, it is expected to send (JNIEnv *env AND jobject *obj)
But currently I am passing NULL, NULL.
Is this correct?
The code runs w/o problem and I able to see the message box "Called".
Issue2: (How do I get c_str from "jstring")The DLL procedure is supposed to return "jstring"
But I need c_str out of it. How do I do the conversion?
I want conversions for atleast
jboolean -> boolean
jstring -> char *
jint -> int
Please help.
-- modified at 1:29 Friday 24th March, 2006
|
|
|
|
|
a1prashant@yahoo.com wrote: While calling the procedure, it is expected to send (JNIEnv *env AND jobject *obj)
JNIEnv and jobject are structures or classes that are declared in "java.h" or "jni.h" . Maybe copying them and passing the values as required should help.
Note: I am a bit tentative about this. I remember there is a file called java.h which contains declarations. Please check the file names. Maybe doing a string search inside java directory should help you. Strings like jobject , JNIEnv . This will take you to the exact file where they are declared.
a1prashant@yahoo.com wrote: But currently I am passing NULL, NULL.
Why?
a1prashant@yahoo.com wrote: Is this correct?
This is wrong. They are expecting something but you are giving nothing!
a1prashant@yahoo.com wrote: (How do I get c_str from "jstring")The DLL procedure is supposed to return "jstring"
Take a look at what jstring is. What kind of datatype is it. Normally these are typedefs or structs . So it must be easy for you once you find them to use them and pass them to funtions.
a1prashant@yahoo.com wrote: I want conversions for atleast
jboolean -> boolean
jstring -> char *
jint -> int
Again I repeat what I said. These are either typedefs or structs . You can copy their declarations.
Nibu thomas
Software Developer
|
|
|
|
|
Thanks a lot for the help.
|
|
|
|
|
Well did it work?
Nibu thomas
Software Developer
|
|
|
|
|
Take a look at these links too...
Java.h[^]
Jni.h[^]
Nibu thomas
Software Developer
|
|
|
|
|
I included the jni.h and jni_md.h files.
However I wonder if following is okay?
The JVM passes JNIEnv and jobjects to the DLL.
Don't know how JVM treats these two parameters before passing.
hInst = ::LoadLibrary("D:\\win_dll.dll");<br />
if( hInst )<br />
{<br />
AfxMessageBox("Loaded win_dll.dll");<br />
typedef void * (__stdcall *fpProc)(JNIEnv *env , jobject obj);<br />
fpProc pfnProc = (fpProc)GetProcAddress hInst, "Java_gui_Win_getCurrFirmware");<br />
if( fpProc )<br />
{<br />
AfxMessageBox("Got Java_gui_Win_getCurrFirmware");<br />
<br />
JNIEnv env;<br />
jobject obj;<br />
VOID * jstr = (fpProc)(&env, obj);
<br />
<br />
AfxMessageBox("Called!");
Thanks!
|
|
|
|
|
a1prashant@yahoo.com wrote: JNIEnv env;
jobject obj;
VOID * jstr = (fpProc)(&env, obj); // Passing w/o initializing
Have you looked at the members of JNIEnv and jobject .
I guess jobject is an empty class.
JNIEnv is a huge class.
What happens when you pass an empty object of JNIEnv to the function. I guess the function will fill it out for you.
Nibu thomas
Software Developer
|
|
|
|
|
It works w/o problem. Actually I'm trying on a sample code, and yet the DLL is not fully loaded.
I'll have to check it after all the things are in place.
Great help Nibu!
Thanks!
|
|
|
|
|
a1prashant@yahoo.com wrote: I'll have to check it after all the things are in place.
Are you checking the output that you get from the function? Well I would like to know!
Nibu thomas
Software Developer
|
|
|
|
|
Hello Nibu,
Sorry for the delayed reply. 2 Day's holiday
I'll soon check it on one of my test machines. And I'll surely let you know the result.
Regards,
Pacific
|
|
|
|
|
I was also having two days holiday.
If it works please tell me. Will be waiting for your response.
Nibu thomas
Software Developer
|
|
|
|
|
When changed an ActiveX object's property by using its property page, clicking on the "Apply" button should reflect the changes to ActiveX object. However, this does not work with my own ActiveX control and clicking on the "Apply" button simply does nothing.
If you know where to put in event handling code for clicking on this "Apply" button, please let me know. Thank you in advance.
|
|
|
|