|
Use the following flag in your DrawText(...) call
DT_RTLREADING - Layout in right-to-left reading order for bi-directional text when the font selected into the hdc is a Hebrew or Arabic font. The default reading order for all text is left-to-right.
|
|
|
|
|
i have two dialog boxes dialog1 and dialog2.when i click on the ok button of dialog1 i wnat to display dialog2 window.how do i do it
|
|
|
|
|
Here ...
CDialog1 Dlg1;
if (IDOK == Dlg1.DoModal())
{
CDialog2 Dlg2;
Dlg2.DoModal();
}
Best regards,
Eugene Pustovoyt
|
|
|
|
|
in the button event handler of dialog 1,
do this
dialog2 dlg;
dlg.DoModal();
//you need to inlcude the header file of the dialo2
I Touched Osama Bin Ladens Bushy Beard
|
|
|
|
|
Here sample of a code to gets a page through proxy with authorizing. First ::HttpSendRequest call returns success, but second call after proxy authorization is wedging. Why!? Where is mistake!?
HINTERNET hOpenHandle, hConnectHandle, hResourceHandle;
DWORD dwError, dwStatus;
DWORD dwStatusSize = sizeof(dwStatus);
hOpenHandle = ::InternetOpen("Example", INTERNET_OPEN_TYPE_PROXY, strProxyName, NULL, 0);
if (NULL != hOpenHandle)
{
hConnectHandle = ::InternetConnect(hOpenHandle, "www.microsoft.com", INTERNET_INVALID_PORT_NUMBER, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
if (NULL != hConnectHandle)
{
hResourceHandle = ::HttpOpenRequest(hConnectHandle, "GET", "", HTTP_VERSION, NULL, 0, INTERNET_FLAG_DONT_CACHE, 0);
if (NULL != hResourceHandle)
{
resend:
BOOL bSendRequest = ::HttpSendRequest(hResourceHandle, NULL, 0, NULL, 0);
::HttpQueryInfo(hResourceHandle, HTTP_QUERY_FLAG_NUMBER | HTTP_QUERY_STATUS_CODE, &dwStatus, &dwStatusSize, NULL);
switch (dwStatus)
{
case HTTP_STATUS_PROXY_AUTH_REQ:
InternetSetOption(hResourceHandle, INTERNET_OPTION_PROXY_USERNAME, (LPVOID)(LPCTSTR)strProxyUsername, strlen(strProxyUsername)+1);
InternetSetOption(hResourceHandle, INTERNET_OPTION_PROXY_PASSWORD, (LPVOID)(LPCTSTR)strProxyPassword, strlen(strProxyPassword)+1);
goto resend;
break;
case HTTP_STATUS_DENIED:
InternetSetOption(hResourceHandle, INTERNET_OPTION_PROXY_USERNAME, (LPVOID)(LPCTSTR)strProxyUsername, strlen(strProxyUsername)+1);
InternetSetOption(hResourceHandle, INTERNET_OPTION_PROXY_PASSWORD, (LPVOID)(LPCTSTR)strProxyPassword, strlen(strProxyPassword)+1);
goto resend;
break;
}
if (HTTP_STATUS_OK == dwStatus)
{
}
::InternetCloseHandle(hResourceHandle);
}
::InternetCloseHandle(hConnectHandle);
}
::InternetCloseHandle(hOpenHandle);
}
Best regards,
Eugene Pustovoyt
|
|
|
|
|
|
I am trying to click Sign Button Window of MSN messenger.But program is crashing at 2nd Sendmessage. This technique works fine with Yahoo messenger. Any suggestions?
{<br />
int iControl = GetDlgCtrlID(hWindow3);<br />
SendMessage(hWindow3,WM_SETFOCUS,iControl,(LPARAM)hWindow3);<br />
hSend = SendMessage(hWindow3,WM_LBUTTONDOWN, MK_LBUTTON,(LPARAM)1);<br />
hSend = SendMessage(hWindow3,WM_LBUTTONUP, 0,(LPARAM) 1);<br />
}
Cheers!!!
Siddharth
|
|
|
|
|
Did you try to replace the first sendmessage with postmessage, or commenting the first sendmessage then again is it craching? if so then there is a prob with 2nd sendmessage.
I Touched Osama Bin Ladens Bushy Beard
|
|
|
|
|
Not sure what exactly causes the crash,
but MSDN defines WM_SETFOCUS as :
wParam - Handle to the window that has lost the keyboard focus. This Parameter can be NULL. <br />
lParam - This parameter is not used.
Perhaps this is what causes the 'confusion' later...
Try simply calling the windows function SetFocus(HWND window);
|
|
|
|
|
If you are trying to Click a button
Why not try to send WM_COMMAND msg to the window with the ID of the button (you can discover it via GetDlgCtrlID() )
Hope it Helps
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
I have an app that's centered around a List-Control.
Over the area not occupied by the List-Control rest several buttons that affect this List-Control .
My minor problem is that whenever such a button is pressed, it grabs the focus away from the list which is something I don't want to happen.
I also have an edit-box which grabs the focus, but that's obviously ok.
What I'm looking for is a method to tell specific controls not to grab the focus yet still remain usable.
Thanks
|
|
|
|
|
Sounds like maybe you need to rethink the application. As a general rule I'd expect something I click on to grab the focus. It would feel counter-intuitive to work otherwise.
If, on the other hand, what you mean is that you want the ListControl to show the current selection even when it lacks focus you can do that by adding the LVS_SHOWSELALWAYS style to the ListControl.
Rob Manderson
http://www.mindprobes.net
Paul Watson wrote:What sense would you most dislike loosing?
Ian Darling replied.
Telepathy
Then I'd no longer be able to find out everyones dirty little secrets The Lounge, December 4 2003
|
|
|
|
|
These 'special' buttons are buttons which usually change the way the list appears, or buttons that trigger menus for example.
These two kinds of buttons are 'state changers' at most, when the user is done with them, he expects to see the selection (more on this at the end) and be able to scroll his mouse-wheel and have the list respond.
I'm already using LVS_SHOWSELALWAYS, but I draw the selection differently when the list is in focus and when it's not, so that the user knows that he's going to mouse-wheel he's going to affect the list (or not).
The most common situation is a button that switches the list's mode from details to icons, etc, etc. Once you click the button, it gains the focus and maintains it, causing the list to loose the focus. In such a case, the user would like the list to maintain the focus.
What do you think ?
|
|
|
|
|
It may be a horrible solution but why not throw focus back to the ListControl when one of the special buttons handles a click event?
[edit]Don't try to do this directly within the event handler. Define a custom message and handler and do a PostMessage to that handler from within the click event. Windows does strange things when trying to change focus from within a focus related event.[/edit]
Rob Manderson
http://www.mindprobes.net
Paul Watson wrote:What sense would you most dislike loosing?
Ian Darling replied.
Telepathy
Then I'd no longer be able to find out everyones dirty little secrets The Lounge, December 4 2003
|
|
|
|
|
I tried that as well, but I don't like it because the focus is removed from the list and then restored, causing a flickering (as I mentioned before I draw selected items differently when in focus and when not).
I'm looking for a solution in the direction of a window-style or something like that, something that will make windows understand that this kind of control doesn't accept focus... if it's possible
|
|
|
|
|
Hello all !
I want to know the time (hh:mm) of creation of a file (or at least the time of the last modification). Wich function can use for that ?
Thanks
|
|
|
|
|
GetFileTime() API function or CFileFind::GetCreationTime(), GetLastWriteTime().
|
|
|
|
|
Hi,
use this
CString CStrFileName;
CStrFileName = "c:\\temp\test.exe";
FILETIME ftCreate, ftModify;
CFileStatus m_FileStatus;
CFile::GetStatus(CStrFileName,m_FileStatus);
AfxTimeToFileTime(m_FileStatus.m_ctime, &ftCreate);
AfxTimeToFileTime(m_FileStatus.m_mtime, &ftModify);
Have A Nice Day
Murali.M
|
|
|
|
|
Ok thanks everybody !
It is what I was searching for
|
|
|
|
|
Hi...
There are some problems which I am not able to solve. They are
consider an MDI application....with three child windows open in it....with three buttons on each child window in the toolbar....actually this is a static MDI application...with three child windows initially....
1. The three child windows in the file should be toggable. Suppose if I click on the 1 in the toolbar then the child window should be shown and if I click it once again then it should be hidden not destroyed.
2. The three child windows should be made dockable like in VC++ the windows are dockable.
3. There are three views in this file. One for Bitmap, second for Color table and the last one for Text. For bitmap and data I don't seem to face any problem but for the color table, I will have to display the colors that are present in the bitmap image in tabular form. The tabular columns consists of three columns one for Index, second for colors in the bitmap and the third for the RGB values of each individual color. But I don't know how to do that.
Please help me regarding the above.
Regards,
Ruchit Sharma. R
|
|
|
|
|
Humm..
First, in order to show or hide a window, you can use the ShowWindow method of the MFC's CWnd class. All windows (basically) support this method call, so you can show/hide a window by issuing the call with a parameter SW_SHOW/SW_HIDE.
The docking system of a window follows a very simple logic: each time the window is moved (WM_MOVE), it checks whether the window is in range X from the window/control/button/whatever it is supposed to dock with. If it is, the window's moving rectangle is repositioned to the docking position. If it is not, the rectangle follows the mouse as it normally would.
You could try to derive from CControlBar instead of CMDIChildWnd . This approach would require you to write extensive drawing code in order to make it work properly. Alternative approach would be to hack the MFC source code and copy the EnableDocking method and it's implementation away from the CControlBar class, and implement it to your CMDIChildWnd -derived class. This approach would require considerate planning and testing that the feature works correctly.
The bad thing is that in the first method, you will lose the benefits of CMDIChildWnd , and in the second method, you might end up doing lots of extra work.
I understood that your MDI application has three child windows, and each of these child windows displays one view. Is this correct ? If so, just create a CListCtrl to hold the index, color swatch and RGB values. If you implement a custom-derived CListCtrl , you can 'paint' the middle cells with a color instead of text, and let the original implementation handle the other cells. Main idea would be that when you insert data into the middle cell, then instead of writing it as text, your control paints it as a rectangle filled with the specified color.
Perhaps you should look at the DrawItem method of CListCtrl to see if it suits your needs. Also, see this article[^] for some help.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
what i should do to build simple animate button....
|
|
|
|
|
|
can anyone tell me how i can query which is the currently installed anti virus packege in my OS[Windows 9x/2000/...]
-------------------------------------------
My application needs to scan application files before it starts using them
So i planned that i needed to get the currently installed antivirus package n call createprocess
like some applications i could have the user input this manually in a cnfiguration dialog
i however have seen that microsoft office products word excel ppt etc
automatically do this when a doc is opened
so i guess the details of the current anti virus packege is stored inthe shell of the OS somewhere like the registry
any ideas????
|
|
|
|
|
are u really sure that microsoft office product use the installed virus scanner?
Don't try it, just do it!
|
|
|
|
|