|
Hi all,
how can i resize my CEdit, (with GetRect & MoveWindow) automatically, when the Main CDialog will be resized??????
On the Main CDialog i want to scale the CEdit to 0,0 cause i dont want a thick border =p ___ How can i manage this??
Please help me!!
Thanx and bye b4ckup
|
|
|
|
|
Maybe I could help, but I can't clearly understand your need? Post some code lines here!
"Socrates is a man. All men are mortal.
Therefore Socrates is mortal."
-- Aristotle (syllogism)
Cheers
Masoud SamimiGo!
|
|
|
|
|
aehm
k .. I have a little dialog based prog with an edit control in there. the edit control should turn up on the upper left @ x = 0 and y = 0, without a border =p _____ ok???? and: when i resize the dialog, the edit control should also resize.
here´s what i think (i know that dont works):
BOOL CMp3insDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CRect rect;
CEdit* ce = (CEdit*)GetDlgItem(IDC_EDIT);
ce->GetWindowRect(&rect);
ce->MoveWindow(&rect);
return TRUE;
}
when i throw the code into:
void CMp3insDlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
}
my programm crashes!!
yeah, i know i´m stupid, please help me
(if you wish i can send you an email with a screenshot from an other programm, where you can see what i mean)
thanX
|
|
|
|
|
Hi!
I tried this last night and it worked:
void CSizeEditDlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
CEdit* ce = (CEdit*)GetDlgItem(IDC_EDIT1);
::MoveWindow(ce->GetSafeHwnd(), 50 , 50, 200, 65 ,TRUE);
::SetWindowText(ce->GetSafeHwnd(),"Hi There! I am being resized! :-)");
}
The above works fine, but better yet I suggest you use the CResizableDialog by Paolo Messina here on CP!
Its here: http://www.codeproject.com/dialog/resizabledialog.asp
It is realy Nice!
Good Luck!
"Socrates is a man. All men are mortal.
Therefore Socrates is mortal."
-- Aristotle (syllogism)
Cheers
Masoud Samimi Go!
|
|
|
|
|
hey! Many thanx .. the CResizableDialog works very fine that´s what i want!!
.. and thanx for your fast help!!
-------------------------------------------------------------------------------
ok here´s how i made it:
void CMyDlg::OnSize(UINT nType, int cx, int cy)
{
CResizableDialog::OnSize(nType, cx, cy);
CRect rect;
CEdit* ce = (CEdit*)GetDlgItem(IDC_EDIT);
ce->GetWindowRect(&rect);
::MoveWindow(ce->GetSafeHwnd(), 0, 0, rect.right, rect.bottom, TRUE);
//hehe rect.right and rect.bottom .. that´s all
}
bye b4ckup (:
|
|
|
|
|
Thankx to you as well! My pleasure! ;-D
Programming is fun! Especially when things work!
Enjoy!
"Socrates is a man. All men are mortal.
Therefore Socrates is mortal."
-- Aristotle (syllogism)
Cheers
Masoud Samimi Go!
|
|
|
|
|
I downloaded the demo project from:
http://codeguru.earthweb.com/controls/multi
line_listbox.shtml
The program works great. In the file MultiLineDialogDlg.cpp,
there is alot of code using the command m_ctrList.AddEntry().
If I take out all of these AddEntry commands, compile
the program, and then click on the white space that now
fills that multiline list box, I get a strcore.cpp error.
If there is at least one entry in the list, then everything
works fine, I can click on empty white space all day
and the program never crashes.
The error is in file strcore.cpp, but when I click to
debug, the compiler doesn't point me in any real direction.
I am clueless as to what exactly I am doing wrong and how
to resolve it.
Please, please, any response any one can give me will be
greatly appreciated.
Sincerely,
danYELL (an overworked graduate student)
|
|
|
|
|
.. If I take out all of these AddEntry commands ..
I think those AddEntry-commands are usefull for understanding the working of this example (I'm not sure, I haven't downloaded the project). Why do you comment those lines out? Does the example work fine if you don't comment them out?
.. I get a strcore.cpp error ..
Are you sure the error is caused there? I think the error is 'created' a long way before that. Check the Call-Stack to trace it to the code where you can 'understand' it. Probably the last function called in the project code. Place a breakpoint there, and check every value (variables) you can find. I'm sure you'll see something weird going on.
Looks like you are trying to do something with an invalid value. For example, a call to GetItemData for an entry that doesn't exist (-1) or an entry that doesn't have ItemData.
The project should check for this (if (this->GetCount() > 0) doSomething()). If it doesn't, the project sux..
--
Alex Marbus
|
|
|
|
|
Hi everybody,
when my doc/view app starts, the Framework does a call to OnNewDocument if no document is specified on the commandline. I would like to change this. What I'd like to do is to open a document.
For this purpose I've created a dialog similar to the dialog that pops up if you start Visual Basic (provided you use the default config). The user can choose whether to open a recently used file, browse for a file or create a new file. How do I get started with this one?
Any help is greatly appreceated.
Matthias
|
|
|
|
|
If mean you don't want the default document to load on startup, then this is the code:
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
Add it in the InitInstance() of your apps class, and then make your selection dialog load and prompt user to select whatever they wanted!
"Socrates is a man. All men are mortal.
Therefore Socrates is mortal."
-- Aristotle (syllogism)
Cheers
Masoud Samimi Go!
|
|
|
|
|
I made a dialog, and turned border: None
but i want to move the dialog when holding on the dialog
like RGN generator example and the MP3 decoder: http://www.codeproject.com/dialog/skinsyse.asp
I looked over and over again but i couldt find anywhere how to do this, hope you know what i mean.
Wow i hope this task isnt that hard for a begginer MFC programmer.
Thanks
|
|
|
|
|
You need to capture the point where the user clicks over the area you want to use to move ( ie in onLButtonDown ), then compare it to the mouse position in OnLButtonUp and call SetWindowPos ( I say this instead of MoveWindow because if you pass SWP_NOSIZE you don't need to know the dimensions of your window ) using the difference. I don't recall off hand if you get a point when you click ( you should ) but if you don't use GetCursorPos to find it out.
|
|
|
|
|
Add a WM_LBUTTONDOWN handler for your dialog:
void CMyDialog::OnLButtonDown ( UINT uFlags, CPoint point )
{
CDialog::OnNcLButtonDown( HTCAPTION, point );
}
This tricks the dialog into thinking the button was clicked in the caption (even though there isn't a caption!)
--Mike--
http://home.inreach.com/mdunn/
Is history an illusion caused by the passage of time, or is time an illusion caused by the passage of history?
|
|
|
|
|
What do i need to do with the: WM_LBUTTONDOWN
I got all the code typed in, but i cant figure out what to do with the WM_LBUTTONDOWN
where do i need to put it in the code and how??
What is a handler anyway??
thanks...
|
|
|
|
|
Umm.. I think you need to step back and do some tutorials on basic MFC before attempting things more sophisticated. The Scribble tutorial is always a good start.
If you dont this already, you would know the answers to the questions you are asking.
|
|
|
|
|
i've written a program which takes a command line. now i need to write a program that can send a command line to the program i've already written.
my original program will take a command line from the 'Run' dialog on the Start menu, but not from my program. i'm currently using WinExec, which is supposedly out of date.
does anyone know how send a command line from a program as if it was sent from the run dialog box?
mrtoast
|
|
|
|
|
I think you want to look at the CreateProcess API.
|
|
|
|
|
Um. Thanks.
I tried to use CreateProcess, and came up with exactly the same problems as i did the WinExec, which is no surprise as WinExec just calls CreateProcess.
I think that the child process is inheriting the environment from the parent process. is there any way that i can actually trigger the child process independently, just as if i had run it from the command line, or the Start Menu->Run window?
I'm not quite sure whats going on but maybe
a) windows isn't letting my child process access any file it likes for some reason
or maybe
b) windows is giving my child process next to no memory
thanks for helping,
mrtoast
|
|
|
|
|
personally, i always use _spawnl and friends. i suppose they all end up calling the same thing at some point but who knows...
-c
|
|
|
|
|
Not sure exactly what you need, but one thing you can try is invoking CreateProcess with NULL as the appname, and a command line that first invokes cmd (or command) and passes it the name of the program you want to invoke.
This should get you a new console which loads its own environment vars. Use the /k switch - "command /k myprog.exe" - if you want the command window to hang around after myprog exits, or /c if you don't.
Only bother with this approach is you need to know if the OS is using cmd.exe or command.com.
|
|
|
|
|
We know there're some labels, buttons, text boxs, ...etc...
But how can we know the ids and types (it's a list view or list ctrl ?) of them.
(MSDN library tell us some of them but not all... (nothing about 'desktop' button, 'create new folder' button)
|
|
|
|
|
Look at dlgs.h to see the ids used, then it's trial and error to figure them all out.
|
|
|
|
|
Spy++ would help you figure these out. The buttons at the top right of the dialog are actually a toolbar, and thus don't have individual IDs.
|
|
|
|
|
i want to make a app where i can put a number in a edit box and save it to a file.
then load it again from the file?? sounds easy just need som help
thank you
|
|
|
|
|
why ? just one number, I'd use the registry. One number lots of different ways, use CFile or Serialisation. Plenty of examples on the site. I'd offer one, but I'm holding a baby....
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|