|
I don't know the country breakdown for different date formats, but in Australia it's dd/mm/yyyy.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
This will work in a *.c file
#include <windows.h>
int foo(BSTR string)
{
char buf[255];
int len = *(long *)(string-2);
memset(buf,0,sizeof(buf));
strcpy(buf,"Hello World");
mbstowcs(string, buf, len);
return 0;
}
|
|
|
|
|
Thanks, Mel. I'll give that a try.
|
|
|
|
|
Hi I'm trying to reposition like so:
void CForm2View::OnSize(UINT nType, int cx, int cy)
{
CFormView::OnSize(nType, cx, cy);
m_editbox1.MoveWindow(0,0,cx,cy,TRUE );
}
except that I modified the code at
http://www.codetools.com/docview/centermdiwnd.asp
to make the CFormView fit exactly and immovably in my MDI frame (took away draggability of the view as well).
The above is causing a debug assertion.
The foll shows the messagebox but doesnt like setwindowtext either:
void CForm2View::OnSize(UINT nType, int cx, int cy)
{
CFormView::OnSize(nType, cx, cy);
//MessageBox("aaaa");
// m_editbox1.MoveWindow(0,0,cx,cy,TRUE );
m_editbox1.SetWindowText ("moving!!");
MSDN says:
Example
// Resize the list control contained in the view to
// fill the entire view when the view's window is
// resized. CMyView is a CView derived class.
void CMyView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
// Resize list to fill the whole view.
m_List.MoveWindow (0, 0, cx, cy);
}
So I am confused. Please respond!
|
|
|
|
|
I see...
The problem is that OnSize() is call a first time when the view is created.
I tested that with a simple dialog based containing a button...
And it's OK...
bool m_bWait => a member of CMyDialog (which is a CDialog derived class)
CButton m_ctrlButton => a member of CMyDialog
class CMyDialog : public CDialog
{
public:
CMyDialog(CWnd* pParent = NULL) {
...
m_bWait = false; // initialize in the construtor
}
...
}
void CMyDialog::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
if(m_bWait)
m_ctrlButton.MoveWindow(0, 0, cx, cy, TRUE);
m_bWait = true;
}
I hope that can help you
Hello World!!!
from Raphaël
|
|
|
|
|
Yuck. Much better to do this:
void CMyDialog::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
if (::IsWindowVisible(*this))
m_ctrlButton.MoveWindow(0, 0, cx, cy, TRUE);
}
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
Of course... It's really better...
Hello World!!!
from Raphaël
|
|
|
|
|
Thank you very much. Your approach works, and I also ran into http://www.codeguru.com/mfc/faq/comments/485.shtml, so the issue is resolved. Much appreciation for your testing!
Thanks,
ns
|
|
|
|
|
I have a CTreeCtrl. There are many many children of the root, and many children of those children and many children of those children and so on. I was wondering if there is a way to find out which position that a selected item is at. I currently get the parent of the parent of the parent and so on until I get a NULL. Is there an easier way?
-Raffi
|
|
|
|
|
What do you mean by "Selected Position".
Normski. - Professional Windows Programmer
|
|
|
|
|
Hi
I try to find informations which can help me to create a simple app (with VC++ 6.0) which invite another user (connected on a network) to reboot his PC...
Can somebody help me?
In advance thank you...
Hello World!!!
from Raphaël
|
|
|
|
|
Something like this:
bool CCyberPC::ShutDown(LPCTSTR szMsg, bool bReboot)
{
if( m_strComputerName.IsEmpty() )
return false;
CString msg;
if (szMsg)
msg = szMsg;
else
msg.LoadString(IDS_SHUTDOWN);
BOOL bResult = InitiateSystemShutdown(
(LPTSTR)(LPCTSTR)GetPCAddress(),
(LPTSTR)(LPCTSTR)msg,
10,
TRUE /*bForceAppsClosed*/,
(int)bReboot
);
return bResult ? true:false;
}
Hope this helps.
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
Thanks...
That's work for my own PC (locally thus) but when I use it to another IP adress (from my network) that doesn't work : bResult is false...
I think that comes from Privilege, but I'm not sûr.
See : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/security/Security/authorization_functions.asp
Hello World!!!
from Raphaël
|
|
|
|
|
Yes, you'll need Administrator permissions to reboot another machine.
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
For the last week or so, my Visual Studio 6.0 decides to shut itself down in the middle of a debugging session. Both the VS and the program I'm debugging gets killed instantly and I'm looking at my wallpaper all of a sudden. Had this ever happened to anyone ?
Funny thing is the exact same thing happened to a co-worker today.
|
|
|
|
|
Suicidal not suidical
|
|
|
|
|
What OS? Do you have the latest service pack (5) installed?
- Shog9 - Aaah... It's time to relax. You know what that means: a glass of beer, your favorite ergo chair... And of course, The Code Project loaded on your Personal Computer System. So go on, and indulge yourself, put your feet up. Lean back and just enjoy the articles. After all, CP sooths even the savage
|
|
|
|
|
Win XP and SP5
Very weird problem
|
|
|
|
|
I have an aboutBox. It's a simple CDialog we all
know and love.
I can color the background of the aboutBox using
OnCtrColor(). In the resource editor, I notice
faint, light blue lines that surround the aboutBox with about a half-inch indentation. I
saw in a program the other day white background
coloring up to those blue lines, then the
standard grey that surrounds it and a border. How
can you make it fill the background of a CDialog
up to the light blue lines?
Please, any response anyone can give me will be
greatly appreciated. I tried changing various
settings in the dialog resource, but nothing
worked.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
I read the article N-Tier application using Managed C++ and ASP.NET - A Tutorial
By Ranjan Banerji
that can be found at the address: http://www.codeproject.com/dotnet/N_Tier_Web_Service.asp
Everything worked smoothly, and it introduced me very well on the web-services with SQL world.
What I want to know is how I can build a client using C++.
How I manage the data in the DataSet?
The function in the WebService returns a DataSet, how I get the data out of it and fill, let's say, an edit control with those data?
Thx!
"Nelle cose del mondo non e' il sapere ma il volere che puo'."
|
|
|
|
|
This is frustrating. I want my controls to be in certain places so I eyeball them and place them on the form. Now when I run the MDI project, these controls dont show up exactly as I placed them and theres all sorts of spaces that I dont want. For example, I want an oK button at the very right hand edge of the form. I draw it there. But its shifted inward (by a lot!) when it runs. So my designtime layout doesnt look like the runtime layout. I need to get a grip on this urgently.
Thanks in advance
ns
|
|
|
|
|
I used Brian harts code (modified) to make the CForm dialog fit the frame and resize with it . Its here in code project. I suspect that I have to some coding to keep my controls at their design time locations. I thought i'd create them dynamically with the constructor and create and all that so i can position them , but I'm not sure what to fill the rect structure with so they move along with the frame.
any ideas?
|
|
|
|
|
Hi,
I need to make my app be 800 by 600 pixels when it starts up. Its an MDI with CFomViews that are tailored to fit exactly into the mainframe and resize with it. I dont know if thats relevant info.
Thanks ,
ns
|
|
|
|
|
Use ResizeParentToFit(FALSE) in the OnInitialUpdate handler of your views.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I am missing the point. I want the mainframe to be 800 600 pixels on the screen when the app starts up. I am happy with the fact that my CFormView fits exactly.
|
|
|
|