|
kapardhi wrote: I have image data present in an Byte array, the image can be a bitmap, jpg or jp2 image. Now how to paint this byte array on my dialog box as an image?
I don't know if posting and reposting again and again will actually do the job...
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
[My articles]
|
|
|
|
|
My application is developed on Multibyte Character Set.Now I want to support UNICODE character set. How can I do it?
Is there any direct way to convert it to support UNICODE character set?
|
|
|
|
|
Are you the same guy as Varun Bhatt ? Anyway, have a look at this thread[^]
|
|
|
|
|
no, Not at all. Why do you think so?
Anyways,thanks for your help.
|
|
|
|
|
Hi,
i am using the function SetWindowsHookEx() to set the keyboard hook. The code snippet is as follows
if(myHook == NULL)
myHook = SetWindowsHookEx(WH_KEYBOARD,(HOOKPROC)myFunction, AfxGetApp()->m_hInstance, NULL);
LRESULT myFunction( int ncode, WPARAM wparam, LPARAM lparam)
{
if((wparam == VK_F10))
{
DoSomething();
}
return ( CallNextHookEx(myHook,ncode,wparam,lparam) );
}
The problem is that the function myFunction() is getting called two times.
Can someone tell me how can i avoid this.
Thanks
|
|
|
|
|
ashtwin wrote:
The problem is that the function myFunction() is getting called two times.
This is normal behavior. When you press a key on your keyboard it generates a keypress and release and if you hold the key down it generates repeat keys. You should probably have a look at how the the KeyboardProc [^]hook procedure is implemented. And if you read About Keyboard Input[^] you will find that you can check the transition state of the key with something like:
if (HIWORD(lparam) & KF_UP)
{
}
Best Wishes,
-David Delaune
|
|
|
|
|
Thanks is is working after checking the condition
if((wparam == VK_F10) && (lparam < 0))
{
DoSomething();
}
|
|
|
|
|
Hi all,
i m creating a dialog based application for client side in client Server communication.
i want to run this application on client side as a service please tell me how can i do this.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Here[^] you will find some ways on how to do it. For others you may search the web in a similar manner
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
|
Hi,All
I want to convert rft format data to txt data with CRichEditCtrl. the code liks belows:
///
void CRichEditorDlg::OnBnClickedButton1()
{
EDITSTREAM es;
es.dwCookie = 1;
es.dwError = 0;
es.pfnCallback = StreamIn;
m_editor.StreamIn(SF_RTF, es);
es.dwCookie = 1;
es.dwError = 0;
es.pfnCallback = StreamOut;
m_editor.StreamOut(SF_TEXT, es);
}
///
DWORD CALLBACK CRichEditorDlg::StreamIn( DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb )
{
return 1;
}
///
DWORD CALLBACK CRichEditorDlg::StreamOut( DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb )
{
return 1;
}
I find that the streamIn can be called back, but the streamOut can no be called back. when I use SF_RTF param in the StreamOut, the StreamOut do call back.
///
m_editor.StreamOut(SF_TEXT, es);
My question is that i hope convert rtf format data to txt format!
Can you help me?
How can I do?
Thanks
SunHaiMin
sunhaiminbnu@tom.com
|
|
|
|
|
The callbacks should be normal functions, not class methods (unless they're static methods, of course). I've just found this code in my archives that writes text out of a richedit control called rich_ .
DWORD __stdcall EditStreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
{
LPCWSTR a = LPCWSTR(pbBuff);
if (dwCookie == 100)
{
}
return 0;
}
void CMyDlg::OnBnStreamOut()
{
EDITSTREAM es = { 100, 0, &EditStreamCallback };
rich_.StreamOut(SF_TEXT, es);
}
Note that where I've specified '100', you can specify any pointer value like (say) the pointer to your CRichEditorDlg object, so you could call back into the object from the callback if you needed.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi,
I need to carry out actions when an individual character is entered into a WIN32 C Edit control. These actions will take place each time a key is pressed and each time a key is released.
Characters will be entered into an Edit control, but the edit control does not know when a keydown/up message is needed, or an onchar.
I would appreciate some help in being able to 'trap' a keydown and keyup event when text is entered in an edit control.
Thanks
|
|
|
|
|
You can subclass[^] the edit control, to process the Windows messages you want to, before passing them on to the edit control.
If you're using MFC, derive from the edit control class[^] to do this.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks Stuart, but I'm using windows 32 API functions and not MFC. Any ideas?
|
|
|
|
|
Yes - the first link[^] in my message showed how to subclass a window just using Win32 calls.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I'm not using a dialog box, I'm using CreateWindow to draw my controls. It appears that the code that you pointed me to is more appropriate for windows interaction with a dialog ctrl: "...The following example shows how to subclass an instance of an edit control in a dialog box..."
If I'm not understanding it correctly, then where in the code would I make changes in order for it to work with my application? I have implemented
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
and
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
|
|
|
|
|
EvScott wrote: I'm not using a dialog box, I'm using CreateWindow to draw my controls.
That's fine - it works just the same.
Here's a code fragment for a small Win32 app I just created - it's just a standard VS2008 Windows app with an edit box created in the standard window. I've sub-classed the edit control to trap the WM_CHAR message and increment the character code (so if you press 'a', the edit control sees 'b'):
WNDPROC wpOrigEditProc;
LRESULT APIENTRY EditSubclassProc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
if (uMsg==WM_CHAR)
++wParam;
return CallWindowProc(wpOrigEditProc, hwnd, uMsg, wParam, lParam);
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
switch (message)
{
case WM_CREATE:
editWindow = CreateWindow(_T("EDIT"), _T("edit"), WS_CHILD|WS_BORDER, 10, 10, 300, 300, hWnd, 0, hInst, 0);
wpOrigEditProc = (WNDPROC) SetWindowLong(editWindow, GWL_WNDPROC, (LONG) EditSubclassProc);
ShowWindow(editWindow, SW_SHOWNORMAL);
break;
Simple, eh?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks for your time and patience Stuart. I'm having problems with the
editWindow = CreateWindow("EDIT", "edit", WS_CHILD|WS_BORDER, 10, 10, 300, 300, hWnd, 0, hInstance, 0);
It doesn't like the hInstance parameter as I have created my Edit and command button windows in the
WINAPI WinMain and I use its hInstance parameter
and not the
LRESULT CALLBACK WndProc
Is there any way round that? Am I doing something obviously wrong?
|
|
|
|
|
Just tried that (creating the edit window outside the WndProc - just after the main window's CreateWindow, but before a ShowWindow call) - I had to add WS_VISIBLE to the style parameter when I moved the edit window creation out of the WndProc. So, change WS_CHILD|WS_BORDER to WS_CHILD|WS_BORDER|WS_VISIBLE.
EvScott wrote: It doesn't like the hInstance parameter as I have created my Edit and command button windows in the WinMain
Can you define "doesn't like" a little more exactly?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks a million Stuart - you're the man. It worked a treat.
|
|
|
|
|
Actually, I've just run it with my code, and the system crashes with an error showing up at
return CallWindowProc(wpOrigEditProc, hwnd, uMsg, wParam, lParam);
When I debug the code, I notice that hwnd has a valid handle but claims to be unused. Details as follows:
hwnd 0x000f070e {unused = ???}
|
|
|
|
|
is this the write way to add percentage
case 5 :
dReg = aReg /dreg x 100;
aReg = dReg;
break;
or do I need to add more
|
|
|
|
|
What do you mean, to add percentage?
case 5 :
dReg = (aReg /dreg) x 100;
aReg = dReg;
break;
Seems ok in calculating a percentage but what do you mean by 'add'?
|
|
|
|
|
it dosn't mean add (=) just in the sense of is this the write way to add the code to the rest of the code?
|
|
|
|
|