|
We have an application, say A which is used to start some other applications (B,C,D). That is when A starts, it also starts B,C and D. Now if any of B,C or D has been started manually, A should not start these applications. I would like to know whether we can implement such a scenario using mutex.
C++beginer
|
|
|
|
|
Yes you can use a named Mutex. If the creation fails with already exists then don't start the app. You will have to use separate names for each app (B, C and D).
« Superman »
|
|
|
|
|
Search the site for "single instance"
|
|
|
|
|
I am writing this program where I read in a line of text.
I am able to enter the text just fine and it stores okay, but then when I go to prompt user for another entry (such as an integer) I get an infinite loop because it is waiting for a valid entry.
example:
cout << "please enter a string of characters.";
cin.getline(tempstringgoeshere, BUFFER);
int selection = 0;
while(selection < 1 || selection > 5)
{
cout << "Please make a selection:";
cin >> selection; // DOES NOT LET ME ENTER ANYTHING HERE - GOES PAST
}
Suggestions?
Thanks,
G
|
|
|
|
|
Its probably because in the first getline the BUFFER is too small or the user is entering a string whose length in bigger than BUFFER.
« Superman »
|
|
|
|
|
I think. In this case, it will go in to loop for characters only.
Might be problem with overload of operator >> with int parameter . It is not handling char properly.
|
|
|
|
|
Hello,
i have an question to, why dont use cin directly like this:
cin >> tempstring; //
with best regards
break;
|
|
|
|
|
Spherelin wrote: cin.getline(tempstringgoeshere, BUFFER);
What is the value of BUFFER and how many characters are you entering? You'll quickly find that tempstringgoeshere is not large enough. Use a string type instead of a char type.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Unless your input is an array of strings then use cin>>tempstring otherwise
use cin.getline(tempstring, MAXBUFFERSIZE, '\n'); this function takes 3 parameters, and the last one is the delimiter i.e. when to signal the function to return.
|
|
|
|
|
hello all:
i need a direct show's filter who can rotate the video
how can i get it ??
thanks in advance.
henry
|
|
|
|
|
You can write one. Also, a Google search on "directshow filter rotate video" may point you
to some helpful sites.
At what point in the filter graph do you want to rotate?
|
|
|
|
|
I have a file, data.dat, that contains a memory map that is used in an other software solution written in an other language. The file contains information in the format:
Address1 0x0000
Address2 0x1000
Address3 0x2000
Address4 0x3000
...
I need to access this file in runtime from my program written VC++ Express. I would like to include the data.dat-file like a resource file when buildning my program. My question is:
How do I include this file as a resource-file and how do I access the file and read information from it? Code examples would be greate.
Best regards
/Desmo
|
|
|
|
|
Add the file as a custom resource.
Then use FindResource, LoadResource and LockResource in that order.
This will give you a pointer from which you can read the data.
« Superman »
|
|
|
|
|
Thanks for the reply,
Unfortunately I can't find what namespace to use or what files to #include to get access to those functions? Do I need .NET framework 3.0 installed?
Thanks in advanced
/Desmo
|
|
|
|
|
Hi all:
I just got 120 (GetLastError()) from GetCurrentDirectory() on WinME, that means the API doesn't implemented. Is there any other reason this call may fails? and any other substitute?
|
|
|
|
|
Are you sure GetLastError returned 120? The documentation says GetCurrentDirectory works on Windows ME too. Here[^] the link is. (See the requirements section there). Use FormatMessage and display your error right there.
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
brahmma wrote: Are you sure GetLastError returned 120?
Yes, I noticed the requirement section, and that was what make me wonder. I try to append the API with "::" but to no avail so far.
But I did see the two functions exported form Kernel32.dll from WinME:
GetCurrentDirectoryA and W
|
|
|
|
|
Can you please post the code?
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
TCHAR tszSetupDir[MAX_PATH] = {0};<br />
GetCurrentDirectory(MAX_PATH, tszSetupDir);
|
|
|
|
|
Note that if your project is unicode aware, then the unicode version of this function,
GetCurrentDirectoryW will be called. You will need MLU (Microsoft layer for unicode) installed on your Windows ME machine.
PS: If you don't care for unicode, you will have to make an explicit call to
GetCurrentDirectoryA
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
Exactly, GetCur...A works! Thanks a lot.
|
|
|
|
|
LiYS wrote: Exactly, GetCur...A works! Thanks a lot.
I would strongly suggest not to use ANSI version of a call in a unicode project. Install MLU and use the Unicode version. The major harm in getting it done this way is that if the path contains unicode characters, this call will fail again.
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
OK, thanks for reminding me!
|
|
|
|
|
|
S.V.RAJKUMAR wrote: give the dll to Access the Records in Dialog based
Apllication ?
WTF do you mean? A dll to access the records in a dialog based app? WTF man.
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|