|
Along these same lines, do you know how to put carriage returns into the CEdit? Yeah, I know, noob question, but I haven't worked much with CStrings and CEdit controls, and I just realized that putting a "\n" into a char buffer then converting it to a CString won't work in a CEdit...how do I do this?
|
|
|
|
|
|
that did the trick...thanks...seems counterintuitive, like I was programming for unix or something...I never even would have guessed that in a million years...
|
|
|
|
|
Also, a totally unrelated way of doing this, but may be of use if you're using a DLL, is to create a shared data segment with #pragam data_seg() and put in a global variable in there which will keep track of the number of instances of subscribers to the DLL. Of course your program will have to import the DLL etc, which is not preferable at all, but like I said if you're already using a DLL it's another option.
|
|
|
|
|
globals are most of the time bad, and can be avoided using OOP data members.
|
|
|
|
|
I made that post in the wrong thread...my bad
|
|
|
|
|
Right now, We have a ClxThreadClass that provides the capablity to create single worker thread for the class that inherits it. The function below shows the class member function that creates and starts the new thread. The desire worker code reside in _ThreadFunc.
<br />
<br />
The Current working design<br />
<br />
bool ClxThreadClass::CreateNewThread()<br />
{<br />
if( m_hThread == NULL )<br />
{<br />
m_hThread = (HANDLE)_beginthreadex(NULL, 0,_ThreadFunc, this, CREATE_SUSPENDED, &uiThreadId); <br />
if ( NULL != m_hThread)<br />
{<br />
ResumeThread( m_hThread );<br />
m_bActive = true;<br />
return true;<br />
}else{<br />
m_bActive = false;<br />
}<br />
}<br />
<br />
return true;<br />
}<br />
However, We sometimes would like to use different function other than _ThreadFunc. How can we overload CreateNewThread member function to take an external and pass to beginthreadex. This external obect is not a member function of base or inherited class.
<br />
bool ClxThreadClass::CreateNewThread( void *ptr )<br />
{<br />
<br />
if( m_hThread == NULL )<br />
{<br />
m_hThread = (HANDLE)_beginthreadex(NULL, 0, ptr, this, CREATE_SUSPENDED, &uiThreadId); <br />
if ( NULL != m_hThread)<br />
{<br />
ResumeThread( m_hThread );<br />
m_bActive = true;<br />
return true;<br />
}else{<br />
m_bActive = false;<br />
}<br />
}<br />
return true;<br />
<br />
}<br />
Scott Dolan
Jernie Corporation
Engineering & Manufacturing
Software, Hardware, & Enclosures
|
|
|
|
|
Maybe something like this:
typedef unsigned (__stdcall *PTHREADFUNC)(void *);
...
bool ClxThreadClass::CreateNewThread(PTHREADFUNC pThreadFunc)
{
if( m_hThread == NULL )
{
m_hThread = (HANDLE)_beginthreadex(NULL, 0, pThreadFunc, this, CREATE_SUSPENDED, &uiThreadId);
...
}
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
Mark Salsbery wrote: typedef unsigned (__stdcall *PTHREADFUNC)(void *);
if this function points to global function, it will work .. if it point to class member function.. then there would be some trouble.. i.e. we have to change the Funtion ptr declaration and pass the pointer of the class to that function!
|
|
|
|
|
Right. The OP stated "This external obect is not a member function of base or inherited class"
which soundedread like it wasn't a class method to me.
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
Mark Salsbery wrote: he OP stated "This external obect is not a member function of base or inherited class"
which soundedread like it wasn't a class method to me.
oops my mistake.. it seems work is taking over me [ ]
|
|
|
|
|
Hi,
Can someone help me?
Im just trying to get a list of all windows users names in a local computer.
GetUserName gives us just the current user:
BOOL GetUserName(
LPTSTR lpBuffer,
LPDWORD lpnSize
);
but I dont know how can I get all the other users in the same machine.
Thanks.
|
|
|
|
|
Maybe this link will help - Users in Active Directory Domain Services[^]
I chose this link since it also has links to an "old" way to enumerate users
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
|
Is it possible to scroll a disabled listbox ? without having to create an owner drawn list.
I have a listbox that gets filled with data but its state is disabled, but I want to be able to scroll the list to see what is in there.
Or maybe I should simply reconsider the UI to allow an enabled list, but "tweaked" to make the list "disabled".
Thanks.
Max.
|
|
|
|
|
If you don't accept drag and drop, and make the list box "no selection," why disable it? The user can't do anything to it with those properties set. What are you trying to prevent that you make it disabled?
Judy
|
|
|
|
|
Yeah, I checked my code, and that's what I have to do.
Thanks.
|
|
|
|
|
Hi to Every one.
I need authentication details. Could any one please kindly helpme in this.
What is authentication, and how to check this authentication. How to use SSL concept in the Email sending program. please help me. this is urgent for me.
Nice talking to you. If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
|
Hi, Mr. Alok Gupta, After long time. Thanks for your sugisition. I already have this link. Doing fighting with that link help. Some things are not executing. saying some errors. Still on fighting in some SSL and etc.. NO wain. some errors comeing.;P searching for conclusion Much happy to meet you again here.
Nice talking to you. If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
G Haranadh wrote: fter long time.
yeah after very long time.. where do you went! me too happy to meet you again....
yeah ssl is tough thing.. try Ultimate toolbox they have some class dealing with ssl!
|
|
|
|
|
Ohh great friend. Now my program is compileing... Its ok. but getting crashes in between. while debug mode.
ThatsAlok wrote: ssl is tough thing..
But i need to do in that only friend. client requirement is that only.
Thanks again.
Nice talking to you. If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
G Haranadh wrote: But i need to do in that only friend. client requirement is that only.
client is god of S/w Industry !
|
|
|
|
|
Thanks a lot Mr.Alok... At last we solved the problem.
Followed some instructions.., Perl installation.., some ssl supported files..., Includeing into our project.., path settings... etc etc... after lots of background work.. now it is compileing and almost working..
Thanks for giveing me support Mr. Alok.
Nice talking to you. If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
G Haranadh wrote: Followed some instructions.., Perl installation.., some ssl supported files..., Includeing into our project.., path settings... etc etc... after lots of background work.. now it is compileing and almost working..
you must have work very hard to achieve same.. good!
|
|
|
|