|
Hello at all,
imagine the following situation:
You have created an auto-signaled event, and multiple Threads are waiting for this event to get signaled. The event in addition gets signaled, and one thread starts its execution which implied the event has gotton nonsignaled. So my question is, when does the event gets again signaled ?
Thanks in advance!
|
|
|
|
|
What made it get signalled originally?
If some process/thread is running and periodically signalling, then presumably it can signal again. If not, something has to happen to kick-start. Would the thread that was started not signal the thread prior to waiting on the event?
Steve S
|
|
|
|
|
|
Greetings...
In VC++ 6 I want to create an activeX that contains another activeX, is this possible?
I have tried subclassing the control but I cant get the thing running?
It works if you subclass from ActiveX's that are listed in the project wizard dropdown (upon wizard project creation, step 2 I think, like BUTTON for example) but does not if you are trying to inherit from a custom activeX!!!
Cheers
|
|
|
|
|
Hi Guys,
I have run into a problem for which I havent found a solution till now.Iam trying to show it here in a perspective in which Iam doing it:
I want to draw a bitmap to the screen
m_deviceContext-is the deviceContext to Which I want to draw my Bitmap.
Its mapping mode is set as MM_TWips.
CDC dcMemory;
dcMemory.CreateCompatibleDC(m_deviceContext);
CBitmap *bitmap=CBitmap::FromHandle(handle);//Handle of BitMap is passed here.
BITMAP bm;
bitmap->GetBitmap(&bm);
CBitmap* pOldBitmap = dcMemory.SelectObject(bitmap);
I draw it as follows:
xCord,-yCord,srBpWidth),srBpHeight are in Logical units.
m_deviceContext->StretchBlt(xCord,-yCord,(srBpWidth),(srBpHeight),&dcMemory,0,0 ,bm.bmWidth,bm.bmHeight,SRCCOPY);
(Figure Attached)
I get the figure but it is drawn from the co-ordinate point "up"(As a mirror Image ).I want it to drawn "Down" from the co-ordinate point or Is there any way to inverse it....
Thanks....
|
|
|
|
|
Solved The Problem...............
|
|
|
|
|
Hi,
I use the function ShellExecute(......) to open a file.
How to find if a file has been already opened?
Thanks,
|
|
|
|
|
hello, i'm doing a project using mfc, vc++... i'd created a dialog as my first window, i decided to create a menu as my second window, however, to link the menu to the dialog is not as easy as what i think...
if i wanna call a second dialog using the first dialong, i may use the .domodal to call it... but if i wanna call a menu, what should i do with it???
help!!!
|
|
|
|
|
I guess it's CMenu::TrackPopupMenu you're looking for, probably with TPM_RETURNCMD flag.
Tomasz Sowinski -- http://www.shooltz.com
no animal was harmed more than once during creation of this post
|
|
|
|
|
If you want the menu options to always be available. Do something like this in your OnInitDialog()
CMenu menu;
menu.LoadMenu(ID_OF_MENU);
SetMenu(menu.m_hMenu);
menu.Detach();// now owned by dialog
DrawMenuBar();
The dialog will destroy the menu automatically when itselef is destroyed
You then just need to write ON_COMMAND() handlers for each item. If you need to enable/disable items, handle the WM_INITMENUPOPUP message and process the individual items there.
Roger Allen - Sonork 100.10016
Roger Wright: Remember to buckle up, please, and encourage your friends to do the same. It's not just about saving your life, but saving the quality of life for those you may leave behind...
|
|
|
|
|
I'v got a CString string as follows
CString strPacket = "$1234567FFFFFFFF#00
I want to parse the string so that str1 = "1234567" & str2 = "FFFFFFFF"
Any suggestions on how to do this
At the moment I'm using the following, however there must be an easier way of doing this.
m_strRspData = "";
for(i = 1; i < 9; i++){
m_strHex = m_strRspPacket.GetAt(i);
m_strRspData += m_strHex;
}
m_strRspData.MakeUpper();
|
|
|
|
|
Try Tokenizer class at Codeproject.
Robert-Antonio
It's a good luck, if you meet a real fink. Then you get a respect to
normal, mid-honest people."
|
|
|
|
|
Something like:
int x = 0;
while (isdigit(strPacket[x]))
{
str1 += strPacket[x];
x++;
}
str2 = strPacket.Mid(x); However, if you are always breaking between the 8th and 9th characters, just use Left() and Mid() .
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
VC6.0
Hello,
i have a question, how can i terminate a process from an another process? Ich my Situation i want start program b.exe from a.exe. But b.exe should start once a time! I do it with that:
1) First start b.exe:
PROCESS_INFORMATION ProcInfo;
STARTUPINFO startupInfo;
memset(&startupInfo, 0, sizeof(startupInfo));
startupInfo.cb = sizeof(startupInfo);
CreateProcess(NULL, // lpApplicationName
"C:\\b.exe", // lpCommandLine
NULL, // lpProcessAttributes
NULL, // lpThreadAttributes
NULL, // bInheritHandles
NULL, // dwCreationFlags
NULL, // lpEnvironment
NULL, // lpCurrentDirectory
&startupInfo, // lpStartupInfo
ProcInfo); // lpProcessInformation
2) Second i check, wheter program is still activ
HANDLE handle = OpenProcess(PROCESS_ALL_ACCESS,TRUE,pProcInfo->dwProcessId);
if (handle!=NULL)
{
... if programm b.exe activ terminate b.exe ...
}
else
{
... start b.exe ...
}
3) If programm b.exe active i terminate it and restart it
I do it with this code:
TerminateProcess(m_pProcInfo->hProcess, 0);
Now i got back to step 1:
This works fine in w2k, but in xp step 2 doesn't work. The handle is always not NULL.
What is wrong? Give's a better way to do that?
Thanks
Chris
Student
|
|
|
|
|
From the top of my head: maybe instead of PROCESS_ALL_ACCESS you should use PROCESS_TERMINATE?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hello Tomasz,
thank you for your tip. I changed PROCESS_ALL_ACCESS to PROCESS_TERMINATE in OpenProcess(...). But i have the same effect as before.
When i alredy had terminated the programm b.exe and it doesn't exist in the tast-manager. I do step 2 and the handle is alawy not NULL. But i see this effect only in XP. W2k show me NULL and I can start b.exe with createprocess.
What do i wrong!
Thanks
Chris
ceuba@gmx.net
Student
|
|
|
|
|
ceuba wrote:
When i alredy had terminated the programm b.exe and it doesn't exist in the tast-manager. I do step 2 and the handle is alawy not NULL. But i see this effect only in XP. W2k show me NULL and I can start b.exe with createprocess.
The process ID may be reused, so maybe you're getting the handle for other process? Anyway, since you're calling CreateProcess yourself, why don't you use another thread and WaitForSingleObject?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I need to convert CString string to unsigned long. Exammple
Need CString strPacket = "FFFFF400" to unsigned long
Also any idea how to add a value to strPacket. What I mean is
strPacket = "FFFFF400" + "4" = "FFFFF404";
|
|
|
|
|
sscanf((LPCTSTR)strPacket, "%ul", &myulVar);
simple, rustik.... assuming that your string is a valid unsigned long value...
TOXCCT >>> GEII power
|
|
|
|
|
Caoimh wrote:
I need to convert CString string to unsigned long.
Use strtoul() for this.
Caoimh wrote:
Also any idea how to add a value to strPacket. What I mean is
strPacket = "FFFFF400" + "4" = "FFFFF404";
Assuming that strPacket is a CString object, this is perfectly valid:
strPacket = "FFFFF400";
strPacket += "4";
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
(cough)
Actually, I think they meant
unsigned long x;
unsigned long y;
x = strtoul(str,NULL,16);
y = strtoul(str2, NULL,16);
strPacket.Format("%08lx", x+y);
Steve S
|
|
|
|
|
I usually use
<pre lang="c++"> _wtol(cstringvar)
- Michael Haephrati מיכאל האפרתי
|
|
|
|
|
I'm thinking about porting a time-critical code from VC++6.0 to VC++7.0, did anyone make something like that and could observe peformance gains ? Probably I'll waste some time doing it...
Tx for any information
GuimaSun
www.nexsun.com.br
|
|
|
|
|
You could theoretically get some perf boost from Whole Program Optimization introduced in 7.0. Of course, it greatly depends on specifics of your code. Did you actually profile it, anyway?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I am getting an value like this
a+(b<<9)+(c<<17)=value
how can i recalculate a,b and c if i only have the value c is a fix value (512) and can also be obtained by
c= value>>17
how can i resolve a and b
|
|
|
|