|
You should re-design your application to work with the UNIX/POSIX threading model instead of trying to build a Windows emulation layer. Use condition variables and mutexes to synchronize the threads.
If you need a platform-independent interface, use Boost threads
|
|
|
|
|
errrrr mouse hook?
u should be enumerating all processes etc
"there is no spoon" biz stuff about me
|
|
|
|
|
That's true. But thing is that to get confidence I am just trapping one process at a time, using mouse. So that I should have good insight into hooking before integrating it with project. I am trying to get information like Handle of the winow, name of the window ..
|
|
|
|
|
Hi..
If all other exe r your..then u can use
1. Mailslot
2. Pipe
& check by communicate with other exe...
This is a good solution..if all exe are your.
One thing is sure that if u are not able to do mouse hook then u need to go in "Process" direction...
Thanks...sumit
Sumit Kapoor
|
|
|
|
|
Hi Pal!
It's not just my exe. I want handle of all the exe windows. The problem I am having is that with mouse hook is that system crashes very often. I am just trying to hook all exe and get handle of the exe I am interested.
with Cheer!!!
siddharth
|
|
|
|
|
I have a data like this
40126024302350123
The first no of this data reperesent what is the no of 4 digit nos in the data.
Here it is 4 because i have 4 4digit no.
If i have 3, 4digit no i will represent like this 3024302350123
CString GetString(int NO )
{
switch (NO)
{
case 1:
return 3024302350123;
break;
case 2:
return 40126024302350123;
break;
case 3:
return 10245;
break;
}
I need your help in these areas
1.The return type i have mentioned is CString .Is this correct one.
or else plz suggest the correct datatype
2.Then i need a function where
to trim the first character of the data and convert that into a integer
and put it into a for loop to fix how many loops the function have.
for example if it is 3024302350123 then the first character is 3 so the for loop should go 3 times and in first loop it should take the first 4 digit and do some operations and in second loop it should take the next 4 digit and do the same operation but with new value ie 2nd 4digits and in 3rd loop it should take the 3rd 4digit no and do same operations with that new no
Sir please if there is anybody who can help me in this
thanks in advance
vimal
|
|
|
|
|
i have no idea what ur actually asking but it doesnt look like rocket science so if u could asctually ask an intelligible question maybe u could get some help
"there is no spoon" biz stuff about me
|
|
|
|
|
hi
I want to program MicroSoft Agent Control in my VC++ application so how i program it.Please help me.Send me some sample code.
222222
|
|
|
|
|
Um, did you even take the time to type "MS Agent" in CP's search box? /ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
enum { IDD = IDD_SYMBOLSELECT };
CListCtrl m_list1;
//}}AFX_DATA
CImageList mm;
............
mm.Create (IDB_SYMBOLS, 16, 100, RGB(192,192,192));
............
DDX_Control(pDX, IDC_LIST1, m_list1);
............
BOOL CSymbolSelectDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_list1.SetImageList(&mm,LVSIL_SMALL);
CString cc;
for(int i=0;i
|
|
|
|
|
Hi, im writting a small W32 application (non MFC) and i need to parse the command line for passed arguments, and since the app MUST be compiled for unicode, the MSDN docs say i should use the GetCommandLine() function to get a unicode version of it, and it also suggests using CommandLineToArgvW() to get a main() style array of arguments and a count.
inside my winmain(), heres what i do:
<br />
int argcount=0;<br />
LPWSTR* arguments=CommandLineToArgvW(GetCommandLine(), &argcount);<br />
<br />
.<br />
.<br />
.<br />
<br />
if(arguments)<br />
GlobalFree((HGLOBAL)arguments);
the problem is that in the GlobalFree() line, the app takes an exception and crashes. but MSDN sais i should do the GlobalFree!
i quote:
"It is the caller's responsibility to free the memory used by the argument list when it is no longer needed. To free the memory, use a single call to the GlobalFree function."
any idea of what im doing wrong?
thanks!
|
|
|
|
|
|
hi, thanks for your reply.
when i ran that code in debug mode on my XP machine, it just caused a "first chance exception" shown in the output window of vc, (i dint even noticed it the first time) later i compiled the release version and it worked OK on windows XP, but when i tried it on NT4 server, then the exception became a "memory cant be read" error message, and the program crashed.
heres the code in "do stuff":
// checkout the command line for passed arguments
int nargs=0;
LPWSTR* cmdargs=CommandLineToArgvW(GetCommandLine(), &nargs);
LPWSTR argument=NULL;
for(int i=1; i<nargs; i++)
{
argument=cmdargs[i];
switch(i)
{
case 1: // 1st arg is times to do the test
{
int tests=_wtoi(argument);
tests=tests>=0? tests : 0;
if(!tests)
{
if(wcscmp(argument, L"0")!=0) // atoi failed or really zero?
days=DEFAULT_TEST_TIMES; // invalid argument!
}
mttimes=tests;
break;
}
case 2: // 2nd is "F" or "f" for File, (writte a log file)
if(wcsicmp(argument, L"F")==0)
dolog=TRUE;
break;
default:
break;
}
}
// release the memory
if(cmdargs)
GlobalFree((HGLOBAL)cmdargs);
the first chance exception occurs in the GlobalFree() line, if i remove it, then it runs fine on both XP and NT4 and both release and debug versions.
|
|
|
|
|
Greetings!
I'm a computer science major. I'm required to use Microsoft C++.net. I'm using the standard edition version 2003. This is the fisrt time I've used this software.
I need to turn in the .cpp, .dsp, and .dsw files. The only problem is that I can't find them. I used the search frature from the start menu and it reports the files that were created along with the software isntillation. I created files and I can't find the .cpp, .dsp, or the .dsw files that go with the files I created. I'm using Windows 2000.
Will you help me find thoes files?
Thanks,
Leonard Fear
|
|
|
|
|
.dsp and .dsw are the VC 6 project files. The names and formats changed in version 7. If you absolutely have to have dsp/dsw, there's a 7-to-6 project converter here on CP.
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber
"That probably would've sounded more commanding if I wasn't wearing my yummy sushi pajamas."
-- Buffy
|
|
|
|
|
void get_comp_move()<br />
{<br />
vector <string> vecStr;<br />
string current;<br />
<br />
if(re == 0)<br />
{<br />
get_rand();<br />
cout << "empty\n";<br />
system("pause");<br />
}<br />
else<br />
{<br />
while(getline(data, current))
{<br />
vecStr.push_back(current);
}<br />
<br />
for(int i=0; i<vecStr.size(); ++i)<br />
{<br />
cout << vecStr[i] << endl;<br />
}<br />
<br />
cout <<"has something in it\n";<br />
}<br />
system("pause");<br />
}
|
|
|
|
|
What doesn't work?
Kuphryn
|
|
|
|
|
i am not using MFC.
i am trying to send an application the key strokes Shift-F5.
what i did was this (i used the decimal values for the key codes):
SendMessage(hwnd,WM_KEYDOWN,116,0);
SendMessage(hwnd,WM_KEYDOWN,16,0);
SendMessage(hwnd,WM_KEYDOWN,16,0);
SendMessage(hwnd,WM_KEYDOWN,116,0);
This combination only performs the F5 key press and completely ignores the fact that i used WM_KEYDOWN with shift before that.
i tried using Spy and found that i am sending the correct messages (like i said - F5 does work). Spy showed that WM_KEYDOWN is the message being sent when i press the keys in that order myself.
i tried other combinations this way with other windows and found out that it is completely NOT working - even with alt and control keys.
how can i make it work? can anyone see the problem?
|
|
|
|
|
i think lParam indicates the repeat count, so shouldnt it be atleast 1 instead of 0?
|
|
|
|
|
when i tried it with lParam = 0, it DID work for F5. i could see that F5 keydown was working, but not the combination Shift-F5.
anyway - i also tried with lParam = 1, and got the same result.
any ideas?
|
|
|
|
|
Hiya I have a .ini which I am reading through looking for [PROFILE2]
and then reading the database name out of the field "Database". It works fine up to the point of displaying the Database Name.
I copy the Database Name into a variable called "Database Name". When I do this, I display Database Name, but if I try to display it OUTSIDE THE LOOP, it is already over-written by the last line of the file.
Here is my code:
ifstream infile;
char szLine[256] = {0};
char Profile[11] = "[PROFILE2]";
char Database[10] = "DATABASE";
char* DatabaseName = new char[20];
infile.open( "\\security.ini",ios::out );
if( !infile )
cerr << "Unable to open file.";
infile.seekg( 0,ios::beg );
while( infile.getline( szLine,256,'\n' ) )
{
sprintf( szLine,"%-s",szLine );
if( strncmp( szLine,Profile,strlen( Profile ) ) == 0 )
{
while( infile.getline( szLine,256,'\n' ) )
{
if( strncmp( szLine,Database,strlen( Database ) ) == 0 )
{
DatabaseName = &szLine[strlen(Database)+1];
AfxMessageBox( DatabaseName ); // displays here
}
}
}
}
AfxMessageBox( DatabaseName ); // error displays a garbage value here!!
infile.close();
I have tried using break when the database name is found but no luck. Can anyone help me with this??
|
|
|
|
|
You should break out of the loop, otherwise you will keep reading until you get to the end of the file.
while( infile.getline( szLine,256,'\n' ) )
{
if( strncmp( szLine,Database,strlen( Database ) ) == 0 )
{
DatabaseName = &szLine[strlen(Database)+1];
AfxMessageBox( DatabaseName );
<code>break;</code>
}
}
You could write this using much less code by calling GetPrivateProfileString[^]
Roger Stewart
"I Owe, I Owe, it's off to work I go..."
|
|
|
|
|
I've been having problems with this for quite a while. I found the problem now... there is an terminator character that is in the encrypted text.
I the MSDN code encrypted the file... wrote it to another which they are both the same length but when i try to read teh encrypted file to a string it stops at that position.... how can I get the whole file set to the string or show all of it in a CString?
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
are u encrypting something and getting zero's in the middle of the data? is that what ur saying?
have u been drinking?
"there is no spoon" biz stuff about me
|
|
|
|
|
Well, it encrypts a long CString of XML, it doesn't have any special characters. It is encryted with the CryptoAPI. Writes it to a file.
(after a lot of trouble I decided to go this route, because the code on CryptoAPI does this and I couldn't get it to work with the string).
Anyways when I use CFile to read the file thats encrypted, it sees teh right length of the file but when I use Read to a char it stops at liek 236, but the read function returns the file length.
-Steven Hicks
CPACodeProjectAddict
|
|
|
|