|
I'm really a beginner of this program,visual c++, so I'm loooking for someone that could help me.
I have to draw a pixel on the screen and I have to find its coordinates because then I'll have to move this point using(maybe) a for loop.
Thanks...and sorry for my english
Baile79
|
|
|
|
|
baile79 wrote: I have to draw a pixel on the screen and I have to find its coordinates...
This is a bit unclear. In order to render the pixel on the device, you must know it's x,y values. There shouldn't be any need to find anything.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
Solved: The issue had something to do with recursing the end process function. I changed how the recursion worked and everythings fine now!
I'm writing a program to remove certain spyware. To do this it needs to get a filename and path from a clsid, possibly end a process, delete the file, and delete the clsid. The problem is, if it ends a process then the clsid variable goes from storing a clsid (eg. {00000000-0000-0000-0000-000000000001}) to having odd characters like: ↑▼% (I hope those show up. It's a cross, an upside down triangle, and a %).
This *only* happens if the code kills a process. Here's the function that searches the registry after being passed a clsid:
int delClsId(char *clsid)<br />
{<br />
HKEY keyHandle,key2,key3;<br />
char rgValue[1024];<br />
char fnlRes [1024];<br />
DWORD size1;<br />
DWORD Type;<br />
<br />
cout << "Reading key " << clsid << endl;<br />
<br />
if (RegOpenKeyEx(HKEY_CLASSES_ROOT,_T("CLSID"),0,KEY_ALL_ACCESS, &keyHandle) == ERROR_SUCCESS)<br />
{<br />
size1=1023;<br />
RegOpenKeyEx(keyHandle,clsid,0,KEY_ALL_ACCESS, &key2);<br />
cout << "Opening InProcServer32 in key " << clsid << endl;<br />
if (RegOpenKeyEx(key2,_T("InProcServer32"),0,KEY_ALL_ACCESS, &key3) == ERROR_SUCCESS)<br />
{<br />
if (RegQueryValueEx(key3,_T(""),NULL,&Type,(LPBYTE)rgValue,&size1) == ERROR_SUCCESS)<br />
{<br />
sprintf_s(fnlRes,"InProcServer32 is: %s",rgValue);<br />
cout << fnlRes << endl;<br />
delFile(rgValue);<br />
cout << "CLSID is " << clsid << endl;<br />
}<br />
RegCloseKey(key3);<br />
}<br />
<br />
if (RegDeleteKey(key2,_T("InprocServer32")) == ERROR_SUCCESS){<br />
cout << "Removed InprocServer32 Key!" << endl;<br />
} else if (RegDeleteKey(key2,_T("InprocServer32")) == ERROR_FILE_NOT_FOUND){<br />
cout << "Couldn't locate InprocServer32 key." << endl;<br />
} else {<br />
cout << "Failed to Remove InprocServer32 Key" << endl;<br />
}<br />
RegCloseKey(key2);<br />
<br />
<br />
}<br />
else strcpy_s(fnlRes,"Couldn't access system information.");<br />
<br />
RegCloseKey(keyHandle);<br />
<br />
char delKey[45];<br />
sprintf_s(delKey, "CLSID\\%s", _T(clsid));<br />
cout << delKey << endl;<br />
int i = 1;<br />
<br />
do{<br />
i = delRegKey(HKEY_CLASSES_ROOT, delKey);<br />
} while (i == 1);<br />
<br />
return 0;<br />
}<br />
From the function for killing the process I've narrowed the problem down to something that happens in the "if" part of this if/else statement:
<br />
if(TerminateProcess(hProc,0))<br />
{<br />
CloseHandle(hSnapShotm);<br />
CloseHandle(hSnapShot);<br />
CloseHandle(hProc);<br />
FreeLibrary(hInstLib);<br />
return 0;<br />
}<br />
else<br />
{<br />
CloseHandle(hSnapShotm);<br />
CloseHandle(hSnapShot);<br />
CloseHandle(hProc);<br />
FreeLibrary(hInstLib);<br />
return 602;<br />
}<br />
If the process isn't running, or there's no process to kill then there's no problem. Also, I realize usually you'll find dll files here, but I wanted to test how all these things would work together and would love to understand what's going on. I'm pretty new to c++ but have a strong programming background and large working knowledge of the registry. Thanks!
-- modified at 1:02 Wednesday 10th May, 2006
|
|
|
|
|
I was trying to retrieve the body of a message using the code below but
It is always returning
MAPI-E-NOT-FOUND:
hr = m_pfldrInbox->OpenEntry(
m_pInbox[msgID].lpProps[0].Value.bin.cb,
(ENTRYID*)m_pInbox[msgID].lpProps[0].Value.bin.lpb,
NULL,
MAPI_MODIFY | MAPI_DEFERRED_ERRORS,
&ulObjType,
(LPUNKNOWN*)&lpMessage);
//MessageBox(0, L"Message Opened", L"", 0);
if (SUCCEEDED(hr))
{
SPropValue * rgMsgprops = NULL;
ULONG rgMsgTags[] = {1, PR_BODY};
ULONG cCount = 0;
// IStream* istream;
ULONG ulNumChars;
// hr = lpMessage->GetProps((LPSPropTagArray) rgMsgTags, MAPI_UNICODE,
&cCount, &rgMsgprops);
hr = HrGetOneProp(lpMessage,PR_BODY,&rgMsgprops);
if (hr == MAPI_E_NOT_ENOUGH_MEMORY)
{
MessageBox(0, L"Not enough memory", L"", 0);
hr = lpMessage->OpenProperty(
PR_BODY,
&IID_IStream,
STGM_READ,
NULL,
(LPUNKNOWN *) &lpStream);
do
{
lpStream->Read(
sBuffer,
255,
&ulNumChars);
// if (ulNumChars >0) printf("%.*s",ulNumChars,szBuf);
}
while (ulNumChars >= 255);
// printf("\n");
hr = S_OK;
}
else if (hr == MAPI_E_NOT_FOUND)
{
//This is not an error. Many messages do not have
bodies.
//printf("Message has no body!\n");
MessageBox(0, L"Message has no body", L"", 0);
hr = S_OK;
}
else
{
//MessageBox(0, "%d", rgMsgprops[0].Value.lpszA, 0);
int x = 0;
do
{
sBuffer[x] = rgMsgprops[0].Value.lpszW[x];
x++;
//MessageBox(0, (LPCWSTR)sBuffer, L"", 0);
//bufferlen = strlen(rgMsgprops[0].Value.lpszW);
}while (((int)rgMsgprops[0].Value.lpszW[x-1] != NULL) && (x <
255));
}
}
If you can tell what is the problem please help
-- modified at 13:58 Tuesday 9th May, 2006
|
|
|
|
|
msolh wrote: It is always returning
MAPI-E-NOT-FOUND:
What is the "it" that is returning this value?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
I mean hr value is always MAPI-E-NOT-FOUND
|
|
|
|
|
I understand that. You did not indicate which of OpenEntry() , HrGetOneProp() , or OpenProperty() was returning that value.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
It is the HrGetOneProp() that is always returning the property tag that I specified. I used the same fuction to retrieve the subject and sender information using PR_SUBJECT and PR_SENDER_NAME property tags and it works. It only fails to get the message body. That is when I use PR_BODY.
-- modified at 13:59 Tuesday 9th May, 2006
|
|
|
|
|
Does this or this help?
For the message that is failing, are you sure it has a body?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
Yeah, I am sure that the message has a body.
|
|
|
|
|
I have created an application and i want to add help to this application. when i press F1, the help should be displayed. where should i add the text and how can i add it in vc++ application. can i type all the text in microsoft word and call it in vc++ application? please let me know the procedure to do this.
Thank You
|
|
|
|
|
You should probably check out the HTML Help Workshop from Microsoft. This would be the standard tool used between about 2000-2004. I'm not sure if .NET came out with something different so I apologize if this is not the standard tool used by the masses anymore. I still code native and use the HTML Help Workshop for my released products. For what it's worth...
HTML Help Workshop[^]
Have fun
|
|
|
|
|
I've not done help in a very long time, but I seem to recall the need for a .hpj file, a .hm file, and a .rtf file. The Help Compiler will compile these into a .hlp file.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
David,
i must agree that the Help Workshop documentation is not very clear when you don't know where to start for a .hlp file.
could you please point out some good tutorials/articles to create one's first compiled help file ?
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
toxcct wrote: could you please point out some good tutorials/articles to create one's first compiled help file ?
I'd start with Google, using some good keywords.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
Microsoft changed from the dedicated Help file format (generated from RTF using the Help Compiler, hpj file, etc) about the time of Visual Studio 6, I think. All Help is done using the HTML help system these days, I am told.
Having said that, I wrote a Help file a year or two back using the old methods (which I was familiar with), because it was easier than learning about the new HTML Help system.
As far as I remember, VS6 supported traditional HLP, but you could add support for HTML help.
|
|
|
|
|
i don't want to create a html help file.could u suggest the procedure to create a rtf file. i know we have to add some footnotes and symbols and save it as a rtf file amd then compile it using help workshop.i want to know how to add footnotes and create a rtf document
Thanks
|
|
|
|
|
You can use any text editor (even Notepad) to create an RTF file, but that is a real pain in the butt. I recommend that you ignore any reference that tells you to write stuff like " {\rtf1\ansi\deff0 " - you can do this and work with raw RTF but there is no need to!
One easy way to make RTF files is to use MS Word (or other common word processors) since "Save As" allows you to save files in RTF format.
In Word 2000, creating footnotes is done by Insert menu / Footnote. In the Footnote dialog box, select Custom Mark, and use the "#" (Context name), "$" (Topic name), "k" (keyword), etc as the marking symbol.
If you do a Google search for "authoring winhelp help", you should get a zillion references. For a start, look at the following:
http://www.geocities.com/Area51/6793/helpsurv.htm[^]
http://www.samspublishing.com/library/content.asp?b=Visual_C_PlusPlus&seqNum=285&rl=1[^]
|
|
|
|
|
Thanks for your response.I have created the rtf file and compiled it in help workshop of visual studion to get hlp file. could you please give me the code to call this hlp file in vc++ application.i am looking for the solution desparately
Thank You
|
|
|
|
|
I can't help you directly with C++ - I use C, a real man's programming language! But this code should work, anyway.
Here is an extract from my main window procedure, where I handle the messages:
LONG WINAPI MainWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_KEYDOWN:
switch(wParam)
{
case VK_F1:
WinHelp(hWndPrimary, ".\\helpFileName.hlp", HELP_FINDER, 0);
break;
|
|
|
|
|
what is hwndprimary in this code?
|
|
|
|
|
It would have been a lot quicker for you if you looked up WinHelp in the MSDN help, to see what parameters it takes. This way you had to wait 12 hours for an answer.
Anyway, my application opens multiple windows, and hWndPrimary is the Handle to the Primary (i.e. main) Window.
|
|
|
|
|
|
the link u gave is good. i have used the same procedure to create help files in VisualBasic application. can i use the same method in vc++ too? i want to display the help when f1 is pressed.whats the code to do this?
Thank You
|
|
|
|
|
Please refer to the next page in the link.
Maxwell Chen
|
|
|
|
|