|
Hi,
Thanx for reply.
Can u pls provide ur email id. so that I can send the snapshot of my requirment.
Thanks,
Subhash
|
|
|
|
|
hi,
this is basha, i don't how to convert money into alphabets in vc++.
Requirements ( visual c++)
1.it will accept all type money range
( one ,ten ,.......billion,million,etc.......)
2.the code will convert money(Rupees and paise format)
3.while enter the value in textbox,after that we press dot. it will allow only two digit.
|
|
|
|
|
ammaappa wrote: while enter the value in textbox,after that we press dot. it will allow only two digit.
The Ultimate Toolbox Masked Edit has more than you need[^]
ammaappa wrote: 1.it will accept all type money range
( one ,ten ,.......billion,million,etc.......)
2.the code will convert money(Rupees and paise format)
It seems you never want to be a programmer, anyway have a look at this repository[^]
|
|
|
|
|
Sounds like a university project....
Anyway, what have you tried so far ?
|
|
|
|
|
I wrote a program in C++ MFC and create 2 more thread , this program ryn on several computers .
recently I bought a new PC and the program can’t create more then one thread .
The same program work nice on other PCs.
All the PCs run WINDOWS XP PRO.
|
|
|
|
|
Did you read the "How to get an answer to your question" sticky post at the top of this board?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Then try debugging it, you will never learn otherwise.
Also, we can't help if you don't give us any details.
|
|
|
|
|
I need to change printer default settings. I am using DocumentProperties function. Here is my code:
if(!SetDefaultPrinter(ptiSel.sPrinter)) return false;
HANDLE hPrinter;
if(!OpenPrinter(ptiSel.sPrinter.GetBuffer(0),&hPrinter,0)) return false;
DWORD dwSize = DocumentProperties(0,hPrinter,ptiSel.sPrinter.GetBuffer(0),0,0,0);
pDefDEVMODE = (LPDEVMODE) malloc(dwSize);
DocumentProperties(0,hPrinter,ptiSel.sPrinter.GetBuffer(0),pDefDEVMODE,0,DM_OUT_BUFFER);
if(pDefDEVMODE->dmFields & DM_DEFAULTSOURCE)
pDefDEVMODE->dmDefaultSource = ptiSel.wTray;
DWORD res=DocumentProperties(0,hPrinter,ptiSel.sPrinter.GetBuffer(0),pDefDEVMODE,pDefDEVMODE, DM_OUT_BUFFER | DM_IN_BUFFER);
if(res != IDOK) MessageBox(0,_T("Could not set printer settings"),0,MB_ICONERROR);
ClosePrinter(hPrinter);
This code is based on msdn sample (http://support.microsoft.com/kb/167345). Settings are not changed. The second call of DocumentProperties retrieves valid DEVMODE structure, I change it and save back to printer, the function returns IDOK result but does not write settings to printer. Can anybody help me?
|
|
|
|
|
|
Thanks. Is ther any way to change printer defaults for all applications?
|
|
|
|
|
Hi,
I have a few thread questions
Would anyone know why someone would use _beginthreadex instead of CreateThread or visa versa
What is the difference between The Value return from GetCurrentthreadId and GetCurrentThread
In processing my DLL ATTACH_THREAD message I am able to get the threadid of the thread being created but not the thread
handle The GetCurrentthread API returns -1
Can I get the Thread handle if I have the the thread id
Thankx
|
|
|
|
|
ForNow wrote: _beginthreadex instead of CreateThread or visa versa
_beginthreadex() internally calls CreateThread for creating thread. In addition to creating thread, it will perform some CRT initializations also. So if you want to call some CRT functions inside the new thread, its better to use the _beginthreadex() function.
ForNow wrote: The Value return from GetCurrentthreadId and GetCurrentThread
GetCurrentthreadId return the current thread ID where GetCurrentThread return the handle to current Thread.
ForNow wrote: handle The GetCurrentthread API returns -1
If you call the GetCurrentthread(), it will always return 0xfffffffe. Actually this is a pseudo handle to the current thread. This value can be used only in that thread. The GetCurrentProcess() also returns a similar value - 0xffffffff.
If you want to get the correct handle value, you need to use the DuplicateHandle() function
HANDLE hRealHandle = 0;
DuplicateHandle( GetCurrentProcess(),
GetCurrentThread(),
GetCurrentProcess(),
&hRealHandle,
0,
TRUE,
DUPLICATE_SAME_ACCESS );
|
|
|
|
|
|
If a message is simulated using SendInput(), is there a way in themessage handler to detect the simulated events?
For instance, if someone uses SendInput with MOUSEEVENTF_LEFTDOWN over my window, is there any way to know or are those messages indistinguishable?
|
|
|
|
|
Unfortunately you are correct that those messages are indistinguishable. SendInput() inserts the input messages directly into the kernel input stream. You can read one of my prior posts[^] regarding how SendInput is actually invoking a privileged system call. [^]
If there is a security reason as to why you want to block this function then the only way I can think of is a driver implementing a SYSENTER hook[^].
Best Wishes,
-David Delaune
|
|
|
|
|
Interesting.
I was afraid there wasn't a way to differentiate those.
Thanks for taking the time to assist.
|
|
|
|
|
Hello.
I am having trouble capturing the mouse wheel messages. Everything works except when WM_MOUSEWHEEL is called, the HIWORD of wParam (combination of WHEEL_DELTAs, positive value means wheel is moved away from the user, negative is towards) is always 0. What is the problem? I am using Visual Studio 2003 btw.
// mousehook.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "mousehook.h"
#define MAX_LOADSTRING 100
HHOOK MouseHook;
static LRESULT CALLBACK MouseProc(UINT nCode, WPARAM wParam, LPARAM lParam)
{
if(nCode < 0)
{
CallNextHookEx(MouseHook, nCode, wParam, lParam);
return 0;
}
int zDelta = ((short)HIWORD(wParam));
if(wParam == WM_MOUSEWHEEL) // This is called properly. I need to know which way the wheel moves, but zDelta is always 0. What could be the problem?
{
}
return CallNextHookEx(MouseHook, nCode, wParam, lParam);
}
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
MouseHook = SetWindowsHookEx(WH_MOUSE_LL, (HOOKPROC)MouseProc, hInstance, 0);
MessageBox(0,"Press ok to unhook","Hooked",0);
UnhookWindowsHookEx(MouseHook);
return 0;
}
I would really appreciate it if someone helped me..please.
|
|
|
|
|
how can wParam be equal to WM_MOUSEWHEEL and, at same time, give you meaningful info about wheel delta?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Sorry forgot to mention..
http://msdn2.microsoft.com/en-us/library/ms645617(VS.85).aspx[^]
wParam
The high-order word indicates the distance the wheel is rotated, expressed in multiples or divisions of WHEEL_DELTA, which is 120. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user.
so ((short)HIWORD(wParam)) should give me what i want, but it gives me 0 all the time.
|
|
|
|
|
sdfghjkqwer wrote: so ((short)HIWORD(wParam)) should give me what i want, but it gives me 0 all the time.
It's a sign thing. the HIWORD macro returns a WORD which is 16bit unsigned integer. The compiler is silently doing some sign extension/conversion magic for you, before casting to a short.
The document page you linked to has a (different) way of getting zDelta - why not use that method?
|
|
|
|
|
How? Please explain, I'm new to programming ![Smile | :)](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
sdfghjkqwer wrote: How?
By reading the Remarks section.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Oh I tried that long time ago. It is the same thing as using ((short)HIWORD(wParam));
It doesn't work.
|
|
|
|
|
// Using this instead
SetWindowsHookEx(WH_MOUSE, ...
static LRESULT CALLBACK MouseProc(int nCode, WPARAM wParam, LPARAM lParam)
{
if ((nCode==HC_ACTION) && (wParam==WM_MOUSEWHEEL)) {
MOUSEHOOKSTRUCTEX* pMH=(MOUSEHOOKSTRUCTEX*)lParam;
WPARAM param=pMH->mouseData;
short zDelta=(short)HIWORD(param);
TRACE("zDelta = %d\n",zDelta);
/*
Output in trace for wheely going up
zDelta = 120
Output in trace for wheely going down
zDelta = -120
*/
}
return CallNextHookEx(MouseHook, nCode, wParam, lParam);
}
<div class="ForumMod">modified on Monday, April 14, 2008 5:48 PM</div>
|
|
|
|
|
I cant find where MOUSEHOOKSTRUCTEX or TRACE are defined
is this it?
typedef struct {
MOUSEHOOKSTRUCT MOUSEHOOKSTRUCT;
DWORD mouseData;
} MOUSEHOOKSTRUCTEX, *PMOUSEHOOKSTRUCTEX;
what bout trace?
Thanks.
|
|
|
|
|