|
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
|
|
|
|
|
what cipher function are u using?
sometimes the encrypted data can result in zero's in the data stream so u can change the cipher or (prolly better) read the file in binary mode
"there is no spoon" biz stuff about me
|
|
|
|
|
CALG_RC4
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
another thing u can do (which is what i do) is hex encode the data after encryption ... then u know u have a valid ascii data stream
"there is no spoon" biz stuff about me
|
|
|
|
|
|
Anybody have a suggestion on how I could continue to use MFC/C++ with XML and avoid COM? I'm looking for a way to exchange XML in a robust, straight-forward fashion between my (server) process and another (server) process.
I like life. Life likes me. ( --Ghost of Christmas Present )
|
|
|
|
|