|
Hi,
Thanks, but I wish not using Win32 API.
I said standard C with no Win32 API.
But it is the function I'm seeking for...
Where can I get the source code of this API?
Thanks.
There is no spoon.
|
|
|
|
|
|
Hi,
As you will notice I am new to this forum. I have a question that you'll consider the most trivial question ever.
I already have a fairly intermediate level in C++ but I always used the "Microsoft Visual C++ 6.0 Introductory edition" software that came with my textbook to write C++ programs. What i used to do is file->new->files->C++ source file (or C/C++ header file) and then write my program, compile it, build it and execute it. Then i always used to delete all the file that were automatically created (other than the .cpp file of course).
I now have Microsoft Visual Studio .NET 2003 but I can't understand a world of its huge "help" content. Can someone point out at some place that really explain STEP BY STEP and in DETAILS what should i do to run codes i have already written, or to write new c++ codes? what are solutions? what are projects? in the C++ projects, what are ASP.NET services, ATL project, ATL Server Project, and the many other options?
thank's guys for any reply.
|
|
|
|
|
How about buying a book or getting one from the library?!
Maxwell Chen
|
|
|
|
|
When you open VC 2005, create a new project, but instead of adding new source/header files like you have been doing, you should add your already created files to the project.
After you created the new project, in a window on the left of the screen, you can see your project files, just as you could with VC6. Right click this and choose 'add files to project', browse for your source files and add them. Once added you can compile them pretty much the same as you could in VC6.
|
|
|
|
|
I have code to run through all the running processes and it gives me the PID of the program that I need. I got OpenProcess to work fine. This is what I have for code:
<code>#include <windows.h>
#include <psapi.h>
//Maximum processes
#define PROCMAXCOUNT 4096
int main()
{
int aa,bb,mode=0;
int IsProgram; //Used to check if a process is StarCraft
DWORD pIDs[PROCMAXCOUNT],pIDssz,pIDscount,Modssz,Modscount;
HANDLE proch;
HMODULE Mods[4096];
unsigned char mbasename[MAX_PATH];
MODULEINFO minfo;
char str[13] = "Program.exe"; //Process Name
HANDLE hProcess;
PBYTE pBuffer;
DWORD dwBaseAddress = 0x0114772C;
DWORD lSize = 0;
DWORD lRead = 0;
/* enumerate processes */
if (EnumProcesses(pIDs,sizeof(pIDs),&pIDssz)==FALSE) {
printf("Error getting process list.\n");
return 1;}
/* show processes info */
pIDscount=pIDssz/sizeof(DWORD);
for (aa=0;aa<pIDscount;aa++) {
/* open process */
if (!(proch=OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_VM_READ,FALSE,pIDs[aa]))) {
continue;}
/* enumerate modules */
if (!EnumProcessModules(proch,Mods,sizeof(HMODULE)*4096,&Modssz)) {
continue;}
Modscount=Modssz/sizeof(DWORD);
/* first module representes own process */
if (!mode) {
Modscount=1;}
for (bb=0;bb<Modscount;bb++) {
GetModuleBaseName(proch,Mods[bb],mbasename,MAX_PATH/sizeof(unsigned char));
IsProgram = strcmpi(str,mbasename);
if(IsStarCraft == 0) //checks if process name is StarCraft.exe
{
printf("Process ID: %i\n",pIDs[aa]);
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pIDs[aa]);
if (hProcess == NULL) { printf("Error opening process with OpenProcess()\n"); }
if (ReadProcessMemory(hProcess, (LPVOID)dwBaseAddress, pBuffer, lSize, &lRead))
{
printf("%s",pBuffer);
}
else { printf("ReadProcessMemory failed.\n"); }
}
}
}
return 0;
}</code>
ReadProcessMemory works fine if lSize is 0, but not if I set it to anything else. So, I have these questions:
1) Is dwBaseAddress being used correctly for the specific address I need?
2) How do I get ReadProcessMemory to read a string from memory and display it as ASCII?
3) What do you set lSize to if you want to read a 4-byte long integer? Setting it to 4 or 0x4 doesn't work.
Thanks in advance.
-- modified at 11:40 Saturday 15th April, 2006
|
|
|
|
|
slippnslide wrote: 1) Is dwBaseAddress being used correctly for the specific address I need?
The base address is the value of the HINSTANCE for the module you're reading from.
slippnslide wrote: 2) How do I get ReadProcessMemory to read a string from memory and display it as ASCII?
ReadProcessMemory() doesn't do any display - you use it to read the bytes you want and then do the display yourself.
slippnslide wrote: 3) What do you set lSize to if you want to read a 4-byte long integer? Setting it to 4 or 0x4 doesn't work.
Err... 4. You're reading 4 bytes, so set lSize to 4. 4 will work if you have got the address correct.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi everyone,
I am using a dialog application and I want to use Message Boxes to send messages to the user. However they seem to be hidden behind the dialog application. As a consequence I have to press the TAB key once and then press Enter to get back to interact with my application. I read in the Microsoft Helo that pressing the TAB key looses the focus of a control. Why does my message box not appear over my dialog application?? Is there another easy way of sending messages to the user. I don't really want to create a lot of modal dialogs.
Can anyone help me with this problem please? I would appreciate any help at all!!
|
|
|
|
|
Laughing Buddha wrote: However they seem to be hidden behind the dialog application.
Check that you're passing the right parent handle to the MessageBox() function. If you're using MFC, you may find it more convenient to use AfxMessageBox() .
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Set the parent of the messagebox as that of your dialog .(pass the dialog's handle to the messagebox).
Regards,
FarPointer
|
|
|
|
|
AfxMessageBox("Sample topmost messagebox in MFC",MB_TOPMOST);
|
|
|
|
|
Argh. Not topmost message boxes. I hate them. What if the user wants to switch away from your application? They shouldn't be forced to close some silly message box just to use another application.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Ryan Binns wrote: They shouldn't be forced to close some silly message box just to use another application
Yeah, your probably right. We should let the important message linger somewhere behind all those other windows. I always love it when I'm trying to close my windows and a stray message box is hiding behind the others keeping me from closing my app until I figure out that there is a modal messagebox hidden somewhere.
|
|
|
|
|
Thankyou for deliberately twisting my words. I specifically said "to use another application"
Message boxes should be on top of all the other windows in your application. They should not be on top of every other application in the system unless they are informing the user of something that affects the entire system, not just your application.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
It has been a couple of days as I am trying to emulate Ctrl-Alt-Del action on Windows NT.
It turns out that there is no any API similar to 'LockWorkStation' supported in Windows 2000/XP.
Recently I found out that there is one undocumented function in User32.dll named 'LockWindowStation'. Does anybody know how I can make use of it? Or does anybody know how can I emulate Ctrl-Alt-Del on Windows NT at all?
Thank You in advance.
Hovo
|
|
|
|
|
I think 'LockWorkStation' supported in windows 2000/xp,'emulate'? what's mean? Is forbid Ctrl-Alt-Del?if you will forbid Ctrl-Alt-Del,that's easy. if you are imitative of the login interface of win2000/xp, you can replace file "gina.dll" to your own gina.dll
|
|
|
|
|
Hello,
I want to implement XP Visual Styles for a MFC DLL. I've read many infos about it in the web but I have still problems.
So what I have done:
resource.h
#define MANIFEST_RESOURCE_ID 2
I imported a new resource with the type 24 as MANIFEST_RESOURCE_ID. So the .rc file looks like:
MANIFEST_RESOURCE_ID 24 MOVEABLE PURE "res\\MyDlgDll.dll.manifest"
stdafx.h
#define ISOLATION_AWARE_ENABLED 1
compiler otion:
/D "ISOLATION_AWARE_ENABLED"
When I build the project with VC8 it works fine: The main application can have the visual styles disabled while the DLL always uses XP styles.
But I must build the DLL with VC6 and this doesn't work. I have installed the newest Microsoft Platform SDK for Windows Server 2003 R2 where I can see in commctrl.h the #if def section for the ISOLATION_AWARE_ENABLED stuff.
I have adjusted the VC6 path to the new include dirc of the platform SDK. But I still use the old VC6 libs because the plaform SDK has no X86 builds of the LIBs.
Maybe the problem is the linking of my dll fo mfc42? (When I comile with VC8 the dll is linked mfc80).
Can someone help me?
THX
|
|
|
|
|
When I go to set break point in my code , I am facing this error message from IDE.
“ One or more breakpoints cannot be set and have been disabled. Execution will stop at the beginning of the program.”
There is no break point in my code.
How to solve this problem ?
-- modified at 8:21 Saturday 15th April, 2006
|
|
|
|
|
This problem happens with MSVC when you place a BP and try to debug the program but the module that contains the BP isn't loaded yet. All you can really do is wait for the module to be loaded then re-insert the BP or use WinDBG (or another debugger which) allows you to place breakpoints in modules which are not yet loaded.
Steve
|
|
|
|
|
It's possible that your source code may not be in sync with your binaries. Try rebuilding the entire project (esp. any libraries or DLLs you link with) and see if that helps.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Check wether its in release mode .
Regards,
FarPointer
|
|
|
|
|
Hi,
I actually I've to complete my project asap.I just have to display the database(MSACCESS) thru comboboxes.I just have to display the corresponding products,of say 1st combobox in 2nd combobox.How do I do it,where should I write the code.
pls hlp
swapna_signsin
|
|
|
|
|
Hi
Please try to use DAO in your program. More help is available in MSDN
regards
KK
|
|
|
|
|
Hi
Write combo box change message function for 1st Combo Box
In the function clear 2nd combo box and write query corresponding to the value of first combo box
regards
KK
|
|
|
|
|
Hi All,
I am trying to implement a SampleGrabber filter which takes two input and gives an output.
My actual requirement is I want to replace an audio stream in any media file with my own audio stream.
Can anybody help me out in this.
Thanks in Advance
Poornima
|
|
|
|