|
Hi All,
I have a form view. I want to display this SDI to Half (Left)of the screen.
Again I have another form view. I want to display this SDI to Half (Right)of the screen.
How to do?
I have changed the CREATESTRUCT structure.
but it is not working.
Any idea.
|
|
|
|
|
You can use SetWindowPos() on your AfxGetMainWnd() after it has been created in your CApp::InitInstance()
|
|
|
|
|
OK SetWindowPos is working thank you.
|
|
|
|
|
You should go for splitter window.
See this sample SDI with split window[^]
Added: Are you talking about two different applications?
|
|
|
|
|
Although Niklas post is correct I should recommend to consider a better design.
Unless you are developing something very specific (like a process plant control synoptic) you should not manage how your window(s) appear on the user screen. You are not the owner of the user environment and the user may also have other application running, may be even more important (or less, depends on the circumstances) than your, and will perceive your popping out at the placement you decide as a sort of ... invadence.
Consider, instead, a different design where a single frame window contains two children (your actual windows), may be either managed through a splitter or with fixed proportional positions.
You decide how the children fits the parent, but let the user free to place the parent in his own screen.
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
Hi All,
I am hooking the ExtTextOutW to capture data before it is displayed on the screen. I use Detours and created a dll and I inject it into an application before it starts.
The hooking works as expected, the problem I face is in the string parameter that is passed to the ExtTextOutW function.
When I log the value of this string to a file, it prints some garbled values. I have been trying to find out why this happens and I found out that it is due to glyphs, fonts and unicode.
The application I want to hook will use only English characters, so I want to convert the glyph values into regular characters so that I can log the English characters that is to be displayed on the screen and not some garbled values that come in the string parameter.
I searched on the internet and I came across a post on this forum
http://www.codeproject.com/Messages/446094/Re-Could-not-hook-proc-CreateWindowExA.aspx[^]
Right now I am unable to purchase the book, so can someone please tell me how I can accomplish converting glyph to a string as Ivo Ivanov as mentioned. Ivo Ivanov, if you are reading this can you please help me.
Thanks,
mich
|
|
|
|
|
Try posting your question in the forum at the end of the article and the author will be notified.
It's time for a new signature.
|
|
|
|
|
hi, I am new to VC++ MFC, i am trying to create a simple app. using MS Visual Studio 2005.
i want to move three button to scroll left when i click the left button, same if i click the right button, it should scroll right. then it will stop if i click the center button.
but i don't know how to start the code part, all did was to create the GUI.
the Design looks like this..
Check URL to view ScreenShot.
http://h1.ripway.com/lgmanuel/Imgs/gui.png
modified on Wednesday, July 14, 2010 5:04 AM
|
|
|
|
|
|
thank you for that info., but i am a total new to VC++ MFC,.
where do i put the code. should i just double click the button and add the code like Visual Basic do?
|
|
|
|
|
|
You should really buy a book about VC++. It is nearly impossible to help someone who has almost no knowledge of VC++ or C++ through a forum. It will take ages to explain some basic concepts. You will be much more efficient by reading a book first.
|
|
|
|
|
i think that's the best thing to do for now?.. read a book and understand the concepts and terminology used in VC++. anyway, thanks for the advice.
|
|
|
|
|
How did you end up in this situation anyway? Did you spice up your CV?
|
|
|
|
|
by the way, here is the app. that i was trying create. you can download the project and check it, it's just a design and no codes yet, i just named the controls to their ID's..
what i am tring to do is move the three buttons until they are totally out the the app window..
thanks for the help guys, appreciate it.
here is the URL to download the project.
http://h1.ripway.com/lgmanuel/VC MFC/MoveTheButton.rar
|
|
|
|
|
who the f*** voted you down here! let me even it
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
and how do i get the current coordinates of the three buttons?
|
|
|
|
|
|
..... update
by the way, here is the app. that i was trying create. you can download the project and check it, it's just a design and no codes yet, i just named the controls to their ID's..
what i am tring to do is move the three buttons until they are totally out the the app window..
thanks for the help guys, appreciate it.
here is the URL to download the project.
http://h1.ripway.com/lgmanuel/VC MFC/MoveTheButton.rar
|
|
|
|
|
Why not leave the buttons where they are and simply call ShowWindow(SW_HIDE) on each of the buttons?
Such as:
<br />
GetDlgItem(IDC_BUTTON1)->ShowWindow(SW_HIDE);<br />
GetDlgItem(IDC_BUTTON2)->ShowWindow(SW_HIDE);<br />
GetDlgItem(IDC_BUTTON3)->ShowWindow(SW_HIDE);<br />
Then somewhere else in your program if you want to show the buttons again:
<br />
GetDlgItem(IDC_BUTTON1)->ShowWindow(SW_SHOW);<br />
GetDlgItem(IDC_BUTTON2)->ShowWindow(SW_SHOW);<br />
GetDlgItem(IDC_BUTTON3)->ShowWindow(SW_SHOW);<br />
|
|
|
|
|
there is no need for hiding the controls., i got an idea that if the LEFT button is clicked, it scrolls all the way to the left until the three buttons are gone, then it shows up on the right side of the app window, likewise with the right button. then it should stop to where the three buttons are if the center button is prssed.
Like the <marquee> tag in HTML, it just scrolls to the direction, then shows up to the other side..
i think but am not sure if i need to get the coordinates?
need help guys. thanks..
|
|
|
|
|
The link does not work. Do you have a Solution ?
|
|
|
|
|
|
Yes that will do the job.
Found an easy TODO for the Timer-Part here ("Using Timers in MFC Applications")
In our Sample it would look like this:
First update your class in MoveTheButtonDlg.h
(Some work is already done by VisualStudio when clicking the Button)
enum {DIR_STOP, DIR_LEFT, DIR_RIGHT};
class CMoveTheButtonDlg : public CDialog
{
...
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnBnClickedMoveright();
afx_msg void OnBnClickedStop();
afx_msg void OnBnClickedMoveleft();
afx_msg void OnTimer(UINT TimerVal);
private:
BOOL StartTimer (UINT TimerDuration);
BOOL StopTimer(void);
UINT_PTR m_nTimer;
UINT m_Direction;
DWORD m_winpos;
};
After that you have to declare Message-Map:
BEGIN_MESSAGE_MAP(CMoveTheButtonDlg, CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_MoveRight, &CMoveTheButtonDlg::OnBnClickedMoveright)
ON_BN_CLICKED(IDC_Stop, &CMoveTheButtonDlg::OnBnClickedStop)
ON_BN_CLICKED(IDC_MoveLeft, &CMoveTheButtonDlg::OnBnClickedMoveleft)
ON_WM_TIMER ( )
END_MESSAGE_MAP()
At last the new members have do be defined:
void CMoveTheButtonDlg::OnBnClickedStop()
{
m_Direction = DIR_STOP;
StopTimer();
}
void CMoveTheButtonDlg::OnBnClickedMoveright()
{
m_Direction = DIR_RIGHT;
StartTimer(1000);
}
void CMoveTheButtonDlg::OnBnClickedMoveleft()
{
m_Direction = DIR_LEFT;
StartTimer(1000);
}
BOOL CMoveTheButtonDlg::StartTimer (UINT TimerDuration)
{
m_nTimer = SetTimer (IDT_TIMER_0, TimerDuration, NULL);
if ( m_nTimer == 0) {
MessageBox (_T("Unable to obtain timer"), _T("IDT_TIMER_0"), MB_OK|MB_SYSTEMMODAL);
return FALSE;
}
return TRUE;
}
BOOL CMoveTheButtonDlg::StopTimer(void)
{
if(m_nTimer) {
if (!KillTimer (m_nTimer)) {
return FALSE;
m_nTimer = 0;
}
}
return TRUE;
}
void CMoveTheButtonDlg::OnTimer (UINT TimerVal)
{
if(TimerVal != m_nTimer)
return;
switch(m_Direction) {
case DIR_LEFT:
m_winpos-=5;
break;
case DIR_RIGHT:
m_winpos+=5;
break;
}
}
I hope you can do the rest at "TI: move to ... " at your own
|
|
|
|
|
this is a step forward.. thanks.. i just thought maybe i needed timers, then poof.. a sample code.. thanks..
just have to modify the code to fit my needs..
but am still having trouble moving the buttons., a trying to work how to move i now?
|
|
|
|