|
Hello, gurus! I try to hooking TextOutA,TextOutW,ExtTextOutA,ExtTextOutW in a Dialog using Microsoft Detours. And turn the string to uppercase before display it.
It works fine in the client area, such as button control,static control and etc. But the Dialog's caption and menu is still in lowercase. Why?
//dlg.cpp
DETOUR_TRAMPOLINE(BOOL __stdcall Real_TextOutA(HDC a0,
int a1,
int a2,
LPCSTR a3,
int a4),
TextOutA);
BOOL __stdcall Mine_TextOutA(HDC a0,
int a1,
int a2,
LPCSTR a3,
int a4)
{
BOOL rv = 0;
char *p = _strdup(a3);
_strupr(p);
rv = Real_TextOutA(a0, a1, a2, p, a4);
free(p);
return rv;
}
CMyDlg::OnInitDialog()
{
DetourFunctionWithTrampoline((PBYTE)Real_TextOutA,
(PBYTE)Mine_TextOutA);
return CDialog::OnInitDialog();
}
|
|
|
|
|
currently my brush is red in color....and it paints something on background.... now i want to repain the ssame area that i painter red WITH A INVISBLE COLOR...that is i want the user to be able to see the background again....
can ayone tell me how do i get a INVISIBLE COLOR please?????
tks a lot...
|
|
|
|
|
Use the XOR property while painting
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
huh????
how to do that?????wat are u talkin about????
With Regards
Joseph R. Thomas
Have a Super Blessed Day!
-------------------------
For God has not given us a spirit of fear, but of power and of love and of a sound mind.
2 Timothy 1:7
|
|
|
|
|
If you are painting the window using BitBlt( ... ) API, you can probably use the PATINVERT attribute for dwRop value.
See this link
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_0fzo.asp
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
I have designed a board using USB port,and write a driver
under windows XP by WinDriver(JUNGO). I use some test soft-
ware to test it, the software can found the device,but I write a application programe to operate the board, the programe can't find the device.
I will know:
1.How to search a device under windows OS?
2.How to get GUID?
3.can you give me a DEMO? Thank a lot!
|
|
|
|
|
Hi..
I am developing an application program that needs to dynamicially load different application program based on user choice. And i need to dynamically load the application description for the user to choose as well.
My solution :
I have found a way to do so by using a listbox that search through the exe files(Application Executable) and load them into the listbox for selection but i need to get the File Description from the VS_VERSION_INFO resource, anyone knows how to do it. I know there are APIs around but they are meant for getting the versions.
Thank You
|
|
|
|
|
Hi
try this (short form):
<br />
DWORD Size, Tmp;<br />
if (Size = GetFileVersionInfoSize(PathName, &Tmp))<br />
{<br />
char *Info = new char[Size];<br />
if (GetFileVersionInfo(PathName, 0, Size, Info))<br />
{<br />
void *lpBuffer;<br />
UINT dwBytes;<br />
<br />
if (VerQueryValue(Info, TEXT("\\"), &lpBuffer, &dwBytes))<br />
{<br />
VS_FIXEDFILEINFO *lpvsFixedFileInfo = (VS_FIXEDFILEINFO *)lpBuffer; <br />
...<br />
}<br />
}<br />
delete[] Info;<br />
}<br />
HTH
Regards,
Frank
|
|
|
|
|
Just study vc++,ask a very simple question,how to call system command in vc++? thanks in advance!
|
|
|
|
|
system("");
usually works. ie, to do a dir, put in
system("dir");
*.*
cin >> knowledge;
|
|
|
|
|
This is probably a very basic question, so bear with me
I'm writing a console program and need to use asynchronous sockets. I wish to use WSAAsynchSelect(). The second parameter is a HWND to the window you want to handle the messages. The third parameter is the message you want handled. The events are specified in the fourth parameter. What I thought I could do was use a message loop, like
while( bRet = GetMessage( &msg, NULL, 0, 0 ) != 0 )
{
if( bRet == -1 )
{
// handle
}
TranslateMessage( &msg );
DispatchMessage( &msg );
}
and have the WinProc handle the message specified in WSAAsynchSelect().
The problem I'm having is that I get an "Invalid Argument" error (runtime) when WSAAsynchSelect() is called and I think it's because I'm sending a NULL instead of a valid HWND.
My question is, does anyone know have advice how to use WSAAsynchSelect() in a console application?
Thanks!
mweiss
|
|
|
|
|
I guess you need to create some window to receive the messages - even in console app you can create windows - best choice will be some invisible - message only window (parent is HWND_MESSAGE ). Then you'll have all - valid HWND , valid MsgProc for that window etc.
Hope this helps
|
|
|
|
|
Thanks for the reply.
I found a way to do it without using the windows. I use WSAEventSelect(), WSAWaitForMultipleEvents() and WSAEnumNetworkEvents(). I set up the events in the main thread and in a worker thread wait for events to occur, check which event it was and handle it. I haven't tested it yet, tho.
Thanks.
melinda
|
|
|
|
|
Yes, that's the better method, but you stated that you wish to use the before method, and I prefer to respect ppl. wishes
Anyway, this is much better what you do now, the messaging part (window) is useful only when you have to handle the winsock 1.
Only disadvantage is that you have two threads - mean the whole design is more complicated due to resource locking etc. I usualy trying to design it that it uses only one thread for all that tasks. But it really depends on the application, so there cannot be a general advice except that I said.
wish you good luck!
|
|
|
|
|
I need help with a few more programs please help me.
Thank you Neville Franks and DougwW48 for help earlier, I appreciate it. Please help me one more time.
I tried these and they start like this one:
#include "conio.h"
#include "stdio.h"
void main ()
{
getch();
}
The questions are:
compile a program that will ask the user for an amount in cents ($1.23 = 123 cents). It should then display the number of quarters, dimes, nickels, and pennies equal to the amount.
compile a program that will ask the user for their age. If the age entered is greater than or equal to 18, the program should display that the user is old enough to vote. Otherwise, the program should tell how many years until the user can vote.
compile a program that will ask the user for two floating point numbers. The second number asked for should be the percentage the user wants to find of the first number. It should then display the result of finding the percentage in this format:
Example:
Enter a number: 25
What percent of 25 would you like to find? 3
3% of 25 is 0.75
Thanks a lot for the help.
I get so close on these but can't seem to get them working, i always get 1 or 2 errors. Thanks
|
|
|
|
|
i think you should post you program...what you have done till now... and ask ppl to rectify your errors rather than asking the questions and make ppl do your homework for you...
it will do you good..
With Regards
Joseph R. Thomas
Have a Super Blessed Day!
-------------------------
For God has not given us a spirit of fear, but of power and of love and of a sound mind.
2 Timothy 1:7
|
|
|
|
|
so close to what?
finishing your homework??
With Regards
Joseph R. Thomas
Have a Super Blessed Day!
-------------------------
For God has not given us a spirit of fear, but of power and of love and of a sound mind.
2 Timothy 1:7
|
|
|
|
|
looking at your question..it seems that these are the first or secong questions of the C++ language learning that you might be doin...if you ask others to do it for you...you wont be able to learn the language at all...
so i suggest u take up a book and start some serious learning...
With Regards
Joseph R. Thomas
Have a Super Blessed Day!
-------------------------
For God has not given us a spirit of fear, but of power and of love and of a sound mind.
2 Timothy 1:7
|
|
|
|
|
Colin;
I agree with the other guys that you really need to learn this stuff on your own if you ever hope to understand it! And don't freak out about projects, it'll only make them seem more difficult. I'll help you out on the money question this time. From the code that Neville and myself have sent you so far, you should be able just to change a few lines and complete your other questions.
colin21 wrote:
compile a program that will ask the user for an amount in cents ($1.23 = 123 cents). It should then display the number of quarters, dimes, nickels, and pennies equal to the amount.
#include <iostream>
using namespace std;
int main()
{
int Total, Quarters, Dimes, Nickels, Pennies;
cout << "Enter the total amount of cents: ";
cin >> Total;
Pennies = Total;
Quarters = Pennies / 25;
Pennies = Pennies % 25;
Dimes = Pennies / 10;
Pennies = Pennies % 10;
Nickels = Pennies / 5;
Pennies = Pennies % 5;
cout << "$" << Total/100 << "." << Total%100 << " is equal to:\n";
cout << Quarters << " quarters\n";
cout << Dimes << " dimes\n";
cout << Nickels << " nickels\n";
cout << Pennies << " pennies\n";
return 1;
}
If you have questions on your other two projects, it would probably be a good idea to post your code so people can help you fix what you have wrong instead of guessing and giving you the answers. I hope I got an A!
Douglas A. Wright
dawrigh3@kent.edu
|
|
|
|
|
the code(s) that you gave me don't work at all. mine use printf and scanf and they use parentheses not << >>. thanks for helping though, i am seeming to get it better now. i will take your advice and post what i have so far and then ask. maybe you can help me better then.
[Colin]
|
|
|
|
|
Sorry about the cin and cout statements, I assumed you were taking c++ and not c. It shouldn't be hard to change them into scanf and printf statements. Good luck!
Douglas A. Wright
dawrigh3@kent.edu
|
|
|
|
|
I use icons from system dlls in my app
TreeView draws thick black edge instead of
transparent shadow. What is the best way to solve this problem?
Thanks in advance.
|
|
|
|
|
Hi,
Don't ask me why, but I wanna create a button the hard way. I don't want to use the CButton class.
So basically I want to call the CreateWindow function with a class I registered my self. I already discovered I can use the predefined control-class WC_BUTTON with the following call to get a button on my window:
CreateWindow(WC_BUTTON,"caption",<styles>,0,0,200,200,hWnd,NULL,hInstance,NULL);
only problem is, I can't link an eventhandler to the button, right? Or maybe I just don't know how..
Anyways, the other way I thought of was registering my own class (using RegisterClass and the WNDCLASS struct) and specifying my own WndProc to handle events. But how do I configure the class as a button, in other words how do I make it look like a button, which is pushable? Or will it actually be that hard that I need to define my own graphics, on MBUTTONDOWN the sunken box is painted, etc.
I'm just interested in the way this stuff works... if somebody knows something, please let me know too
Many thanks in advance,
DanglingDude.
|
|
|
|
|
If i right understand your question
it can be done creating button using
CreateWindow(WC_BUTTON ...) and then setting its WndProc
to your own defined using
<br />
LONG DefWndProc=SetWindowLong(hWndButton,GWL_WNDPROC,lpfnYourOwnWndProc);<br />
you should also call default button process using pointer returned by SetWindowLong() at return of your own WndProc.
|
|
|
|
|
Aaaah, this is exactly what I needed.
Thanks alot!
|
|
|
|
|