|
i was just hoping if i can pause a spawned process, maybe my ReadFile may return something from the application. because in my redirection class, it waited till the application fisnished before it can redirect its output into the editbox.
The thing is i have no coding access to the spawned process.
Actually if you will try to pause it manually, you can. by pressing the pause/break key.
i need to learn more... i want to be like you guys... i'm just a begginer
|
|
|
|
|
rupert_durans wrote: i'm a newbie here, i just want to ask if you an idea on how to pause a console app that is being spawned by the CreateProcess() function?
Have you tried CREATE_SUSPENDED . You can pass this flag to dwCreationFlags parameter of CreateProcess .
|
|
|
|
|
hello everybody !!
my new problem is that i have a class that contain a some functions and some variables
i want to execute one of these functions in a separate thread using AfxBeginThread(...);
and FYI this function uses some member variables of the class to do it's work
any idea ???
thnx 4 ur time and concern
a.hemdan
|
|
|
|
|
Pass the address of the instance of the class from which you want to call a member function as an argument of your thread. When you start a thread, you can pass a user defined parameter that will be passed to the function of your thread. There, pass the pointer to your class instance. In your thread function, cast it back to the class pointer and call the member function.
|
|
|
|
|
Hi
I have a friend who somehow encountered that and i remembered that he made a structure of the class and pass it on to the thread so that the member viriable can be used by the thread.
Try to research about worker thread and UI thread, you may find how to use member viriables of a class inside the thread by using struct.
Hope i have helped you somehow.
i need to learn more... i want to be like you guys... i'm just a begginer
|
|
|
|
|
rupert_durans wrote: he made a structure of the class and pass it on to the thread so that the member viriable can be used by the thread
What do you mean by making a structure of the class ? Why not simply pass the address of the class instance (the this pointer) to the thread ?
|
|
|
|
|
yup,
i asked him again and you are right, you may or may not create struct as long as it points to the class instance.
i need to learn more... i want to be like you guys... i'm just a begginer
|
|
|
|
|
Ok but why do you want to do such a thing ? What is the advantage of wrapping your class into a structure just to pass it to your thread ? Pass it directly, it's much cleaner. Why adding complexity where this is not required ?
|
|
|
|
|
hehehe, soweee, i'm just a newbie, i just saw it on my friend's code...
now i know that it can be direct,
can you please give me example on how to declare a pointer to the class instance?
i need to learn more... i want to be like you guys... i'm just a begginer
|
|
|
|
|
rupert_durans wrote: can you please give me example on how to declare a pointer to the class instance
You don't really 'create a pointer to the class instance'. What you have in fact is an instance of your class:
CMyClass Inst;
Here, Inst is an instance of CMyClass. The address of this class is obtained with the & operator:
CMyClass* pPointer = &Inst;
If you pass this address as a parameter to your thread function, you'll be able to access its member:
void MyThreadFunc(LPVOID pParam)
{
CMyClass* pClass = (CMyClass*)pParam;
pClass->MemberFun();
}
You can also start your thread inside a member function of your class, then simply pass the this parameter:
void CMyClass:SomeFunction()
{
_beginthread(MyThreadFun,0,this);
}
|
|
|
|
|
thank you
i need to learn more... i want to be like you guys... i'm just a begginer
|
|
|
|
|
Cedric Moonen wrote: You don't really 'create a pointer to the class instance'. What you have in fact is an instance of your class:
CMyClass Inst;
Here, Inst is an instance of CMyClass. The address of this class is obtained with the & operator:
CMyClass* pPointer = &Inst;
Hi Cédric,
Isn't "Inst" an instance of the class and "pPointer" a pointer to an instance of the class?
Mark
|
|
|
|
|
is it like this one for example?
CMyFileSpyDlg* _this;
i need to learn more... i want to be like you guys... i'm just a begginer
|
|
|
|
|
can you also answer my question above?
HOw to pause a spawned process?
i need to learn more... i want to be like you guys... i'm just a begginer
|
|
|
|
|
Hi ,
I want to force my Edit box to get unicode characters.
Because I am using Arabic/Persian characters and I want to get codes
from EditBoxes and It is diffrent to get Ascii or unicode.
please help me.
thanks.
Every new thing you learn,Gives you a new personality.
|
|
|
|
|
compile your app with UNICODE,_UNICODE preprocessor definitions
Greets,
Davy
|
|
|
|
|
dSolariuM wrote: Because I am using Arabic/Persian characters and I want to get codes
from EditBoxes and It is diffrent to get Ascii or unicode.
make you project unicode enabled, you can change it in Project properties or using _UNICODE macro in stdafx
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi, everyone
We occurs a problem that our pogram occupies a very high CPU Usage even if with no any operation on it.
And we really want to know what leads to the HIGH CPU USAGE? I have searched a lot of topic about this. But...
I just consider the large amount of user objects occupies the CPU. But if the large amount of user objects will cause the high CPU Usage?
(NOTE:Our project has a large amount of user object of 8597.)
THANKS.
//////////////////////////////
|
|
|
|
|
willbin wrote: And we really want to know what leads to the HIGH CPU USAGE?
When your code does stuff, that's all.
willbin wrote: I just consider the large amount of user objects occupies the CPU.
No - why would it ? They occupy memory. The CPU is occupied if stuff is being done, not if stuff is in memory.
Does your project have many threads ? If not, then something must be seriously wrong if your CPU maxes out when you're not doing anything. Otherwise, you have active threads, you need to work out why and if you can change that.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Christian Graus wrote: Otherwise, you have active threads
yes.There is a timer event in the project. I removed the timer, the CPU Usage is reduced.
THANKS Christian.
//////////////////////////////
|
|
|
|
|
Hi all,
Anyone experienced with MS RTC Client API?
I came accross the following issue:
Developed a server APP where each client is initialized with InitializeEx(RTCIF_DISABLE_MEDIA). Then I connect with office communicator using account A on the same backend LCS instance.
When I send a message from A (office communicator) to any account B connected with my APP, office comm complains "The following message could not be sent...".
MSDN says I sould answer to incoming sessions of type APPLICATION with pSession->AnswerWithSessionDescription();
I used code like this:
<br />
HRESULT OnRTCSessionStateChangeEvent(IRTCSessionStateChangeEvent2* pEvent)<br />
{<br />
RTC_SESSION_TYPE enType;<br />
RTC_SESSION_STATE enState;<br />
<br />
IRTCSession2* pSession;<br />
pEvent->get_Session(&pSession);<br />
<br />
pSession->get_State(&enState);<br />
pSession->get_Type(&enType);<br />
<br />
if (enType == RTCST_APPLICATION && enState == RTCSS_INCOMING)<br />
{<br />
BSTR type, desc;<br />
pSession->GetRemoteSessionDescription(&type,&desc);<br />
pSession->AnswerWithSessionDescription(type,desc);<br />
SysFreeString(type);<br />
SysFreeString(desc);<br />
}<br />
if (enState == RTCSS_CONNECTED)<br />
{<br />
}<br />
else<br />
{<br />
pSession->Release();<br />
}<br />
}<br />
Some more thoughts:
1) With the above code I cannot use pSession->SendMessage(NULL, myMsg, 0). It fails with error code INVALID SESSION STATE. I am interested only in IM kind of communication, not in media exchange
2) How can I detect more info about an incoming session. The desc variable above only contains some SDP data, nothing about who (WHAT APPLICATION) originated the request
Any help wpuld be appreciated. Thanks
Cristi
Discover beauty in whatever you're doing
|
|
|
|
|
I have an application displaying an activex component which is in vc++. The component contains some tooltips which need to be printed. The tooltips are created using the CWindow class which takes in the class name in the ctor as TOOLTIPS_CLASS. Is it possible to print the tooltips?
|
|
|
|
|
|
Hi,
how to identify dbf version dbase II,dbase III,dbase IV. before open the database using CDaoDatabase member Open(). Any one help me out.
Thanks In Advance!
Have A Nice Day!
Murali.M
|
|
|
|
|
Here's a description for what the dBASE II file format looks like: http://www.clicketyclick.dk/databases/xbase/format/db2_dbf.html#DBII[^]
The first field in the header is the version field. For dBASE II it's apparently a 2. I'm willing to bet money that the field is 3 for dBASE III, and 4 for dBASE IV. You can always verify this by examining files you have.
Basically, all you have to do is to read the first byte of the file, and inspect its value!
--
Verletzen zerfetzen zersetzen zerstören
Doch es darf nicht mir gehören
Ich muss zerstören
|
|
|
|