|
Using ColeDatetime i am able to get system time ... can anybody help me how to find out User name logged in to the system.. I checked Registry also but i m not getting any clue..
help needed..
Megha
|
|
|
|
|
|
thank u dear.. it worked.. thanks
|
|
|
|
|
Welcome
- NS -
|
|
|
|
|
Hi,
I have an application which writes data(e.g strings) to the events log.
Now,I need to write an application which reads the data from the events log at the same time that
the first application write the data(i.e Logger).
In that application I want to create 2 threads:
The first thread will read the data from the events log,put the data(EVENTLOGRECORD) in a message,
and send it to the other thread.
The second thread will receive the message from the first one,decode it and dispaly the data in a list box.
My questions are:
1. Which is the best (and effective) way to send messages between threads?
2. In the second thread(the one which responsible for the display) - how does the thread receive
those messages?
Do I need to call PeekMessage() and DispatchMessage() in a loop?
I heard about WaitForSingleObject() option,but I didn't understand how to use it...
Can anyone point me to a good tutorial about messages between threads?
I googled a little but could'nt find something usefull...
With best regards,
Eli
|
|
|
|
|
You will need to create an Event object and then use WaitForSingleObject on the event object to notify the read thread that it's ok to wake up and started reading.
The log buffer will need to be protected using a critical section, so that the writer thread is blocked from writing to the log while the reader thread is still reading.
Once the reader thread is done, it exits the critical section and then goes back to waiting on the event object.
---
Yours Truly, The One and Only!
devmentor.org
Design, Code, Test, Debug
|
|
|
|
|
If the threads belong to the same process, you can make a global structure, and can share the object of the struct in both threads for communication. In this case you need not to call PeekMessage and DispatchMessage.
You can also use PostThreadMessage. In this case the thread to which the message is posted retrieves the message by calling the GetMessage or PeekMessage function.
When a running program encounters WaitForSingleObject(), it waits untill the given thread/object does not enters in the signaled state or the time-out interval elapses.
|
|
|
|
|
i am using jdk1.4 and vc++ 6.0 console application !
//Its tt.java simple Helloworld program .which i am willing to call from c++
// i created .class and .h file of it !
public class tt {
public static void main(String[] args) {
System.out.println("Hello World ");
}
}
//*****************************************************************************************
//i wrote it in vc++ 6.0
//for this i added path of tt.h(created using javah) in preprocessor path(underprojects=>setting=>c/c++ tab)
//then added path of jvm.lib (under projects=>setting=>link tab)
#include "jni.h"
#define PATH_SEPARATOR ';' /* define it to be ':' on Solaris */
#define USER_CLASSPATH "C:\j2sdk1.4.2_05\bin" /* where tt.class is */
int main()
{
JNIEnv *env;
JavaVM *jvm;
jint res;
jclass cls;
jmethodID mid;
jstring jstr;
jclass stringClass;
jobjectArray args;;
JavaVMInitArgs vm_args;;
JavaVMOption options[1];
options[0].optionString ="-Djava.class.path="USER_CLASSPATH;
vm_args.version = 0x00010002;
vm_args.options = options;
vm_args.nOptions = 1;
vm_args.ignoreUnrecognized = JNI_TRUE;
/* Create the Java VM */
res = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
if (res < 0) {
fprintf(stderr, "Can't create Java VM\n");
// exit(1);
}
cls = (env)->FindClass("tt");
if (cls == 0) {
// goto destroy;
}
mid = (env)->GetStaticMethodID(cls, "main","([Ljava/lang/StringV");
if (mid == 0) {
// goto destroy;
}
jstr = (env)->NewStringUTF(" from C!");
if (jstr == 0) {
// goto destroy;
}
stringClass = (env)->FindClass("java/lang/String");
args = (env)->NewObjectArray(1, stringClass, jstr);
if (args == 0) {
// goto destroy;
}
(env)->CallStaticVoidMethod(cls, mid, args);
//destroy:
if ((env)->ExceptionOccurred()) {
(env)->ExceptionDescribe();
}
(jvm)->DestroyJavaVM();
return 0;
}
/// After doing that much ! program gets compiled easily but at run it says JVM cant created and returns error value -1 means unknown error (as per jni.h)
// please help me sir....what changes i should do so that it gets run n calls java method ?
|
|
|
|
|
I guess that your Java isnt properly. Have you installed the asked machine version?
Is the options[0].optionString a good string and also complete?
PS: you can write "env->" instead of "(env)->"
Greetings from Germany
|
|
|
|
|
Please for next messages use the < pre > and < /pre > tags (without the spaces) to englobe code snippets. Its easier to read.
This is an example of < code > and < /code > to highlighting sentences
And this is
another example
< /pre >
tags for code snippets
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
if i put JNI version 1.4 in version field still its not working !
version n all is not the problem because that error will return -2,-3,-4 etc..
but its returning -1 ! which unknown error ....
i have one more question . using JNI_GetCreatedJavaVMs(&jvmbuf,1, &ijvm) can we invoke JVM? here how to get (JNIEnv *env) pointer from obtained fields like jvmbuf ? so that i can use that enviroment pointer for finding class n then method id ..... ?
can u please write code for that?
PS dont forget to comment on 1st question too !
|
|
|
|
|
hi all
On the Visual C++ Tools menu, click ActiveX Control Test Container option
i dont find this
please tell me where is is this ActiveX Control Test Container in tools menu
|
|
|
|
|
p_ wrote: i dont find this
I dont' know why u didn't find the option ? It's there in the tool menu in both vc6 and vc8.
You can also go to same by -
Start Menu -> Programs ->Microsoft Visual Studio 6.0 ->Microsoft Visual Studio 6.0 Tools ->ActiveX Control Test Container
|
|
|
|
|
i am using vc 6.0
but i dont find this option sir
please tell me how to find this option
|
|
|
|
|
Tell me the names of all menu commands available under Tools Menu.
|
|
|
|
|
sir these options are :
source browser
visual component manager
register control
visual component manager
visual component manager
visual component manager
customize
option
macro
record quick macro
play quick macro
|
|
|
|
|
p_ wrote: visual component manager
register control
visual component manager
visual component manager
visual component manager
The menu item visual component manager is appearing 4 time in the menu. I think that someone has customized the menu in this way, that's why you are not getting the original menu.
To reset, go to tools->customize menu.
Select Tools tab to set the menus back.
For testing i removed my menus so even i don't have the original menu options. You can get them from start->programs->Microsoft Visual Studio 6.0->Microsoft Visual Studio 6.0 Tools->Tools.
Good luck
|
|
|
|
|
sorry for that sir
bur stil in customize and in tools only
visual component manager
register control
visual component manager
visual component manager
visual component manager
are present
thanks sir
|
|
|
|
|
Please read carefully.
In the customize->tools tab, you can ADD, MODIFY or DELETE existing menus.
Click on any menuitem in the list to edit/delete it.
You can double click on the blank line at the end of list to add new menu.
The list contains the name of menu to be displayed and the command contains the execuatble to run on hitting the menu.
This is all i can tell and hope this will help.
Good luck
|
|
|
|
|
Dear Friends,
i just thought of opening a Website link from my VC++ application. how to do that can any body help me out plz?
i just wanted to know are there any API with help of which i can open a web link?
Megha
|
|
|
|
|
ShellExecute(0, L"open", L"www.codeproject.com", NULL, NULL, SW_SHOWNORMAL);
- NS -
|
|
|
|
|
NS17 wrote: ShellExecute(0, L"open", L"www.codeproject.com", NULL, NULL, SW_SHOWNORMAL);
No. use L extension where you're certain that UNICODE is defined.
the following should be more secure and extensible code :
::ShellExecute(NULL, _T("open"), _T("www.codeproject.com"), NULL, NULL, SW_SHOWNORMAL);
|
|
|
|
|
Oops I didnt notice that when I copy-paste...
- NS -
|
|
|
|
|
See CHtmlView and CDHtmlDialog classes.
|
|
|
|
|
draw a sdi or any app
but base class should be viewHtml and it has OnInitialUpdate()
fun automaticlly change site name only
code is:
void CMyHtmlAppView::OnInitialUpdate()
{
CHtmlView::OnInitialUpdate();
Navigate2(_T("msdn.microsoft.com/visualc/"),NULL,NULL);
}
i think it help u
|
|
|
|