|
Miri
try the following, you need to add Carriage Return and Line Feed characters to the end of the string to get it to create the file in DOS format and not Unix.
CString strMsg = "Line 1\r\nLine 2\r\n";
CFile OutFile;
OutFile.Write(strMsg, strMsg.GetLength());
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
|
|
|
|
|
Could you use CStdioFile instead, that has a WriteString method.
|
|
|
|
|
Does anyone know a simple class/method that performs
URL encoding and can be used to encode data for HTTP POST
requests?
Thank you!
|
|
|
|
|
1. Both we know in the XP system, we can switch user.
2. If i installed an AP in "user1" and lanch it.
3. Then i switch into "user2", and user2 will lanch the same AP too.
4. How to design the AP can dectect the AP has running in another user?
Evil
|
|
|
|
|
Probably the registry - HKEY_CURRENT_USER is a virtual key, that is mapped to the user logged in.
Dunno about in XP though.
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
You can create a semaphore with the 'Global\' prefix, just like you would if you were coding for Terminal Server (I think they based the code for Fast User Switching partly on it).
HANDLE hMySemaphore = CreateSemaphore ( SemaphoreAttributes, 1, 1, "Global\\ThereCanBeOnlyOne" );
Note that you'll have to remove the back hack if you’re going to be running the application on Win9x or NT 4.0 (Win2K will just ignore it).
Ben Burnett
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
I had tried this way, but it seem work correct in the same user, but can't work when i switch into another user in XP.
|
|
|
|
|
take a look here to get information about fast user switching...
|
|
|
|
|
I'd like to store the position of my Winamp general purpose plugin in the registry so that I can display it in the same position after a quit. I think I know how to do this - my only problem is that I can't trap the proper message to store the WINDOWPLACEMENT struct for my plugin's window before quit. I tried overriding CMyWindow::OnDestroy(), but it apparently isn't getting called. CMyWindow::PostNcDestroy() is to late (the window placement info has already been destroyed). My plugin App is derived from CWinApp and my plugin's window is the m_pMainWnd member varible set as a derviation from CWnd.
I'd like to know what I could be doing wrong or an alternative way to get the job done.
thanks!
Marc Flury
m-flury@northwestern.edu
|
|
|
|
|
Have you tried doing it in your plugin's quit() function?
--Mike--
http://home.inreach.com/mdunn/
"Make sure that if you are using a blow torch that you don't set anything on fire."
-- Chris Maunder
|
|
|
|
|
Yeah, I did. Unfortunately, that seems to be too late; GetWindowPlacement() won't work (I guess the window is already long gone by the time quit() happens );
Marc Flury
m-flury@northwestern.edu
|
|
|
|
|
You don't get an OnMove message ? That's where I always do it for my apps, but never written a Winamp plugin.
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
Try overriding CMDIFrameWnd::DestroyWindow() instead of handling the WM_DESTROY message. It works in my apps. Heres how I do it:
Check out:
http://www.codeproject.com/useritems/windowplacement.asp
For more info.
(2b || !2b)
|
|
|
|
|
I want to use a couple of child windows in my SDI application (with caption, min and max boxes, etc...(eg. WS_OVERLAPPEDWINDOW). They are children of CView. When I create them in response to CView's WM_CREATE, the children are not shown. But when I regster a class for my children, the are shown. Why is like that?
But the real problem is that those windows don't have a focus (even when a caption bar is clicked they still have inactive caption!!). Pressing a key generates WM_KEYDOWN for CView not for the child window.
Another problem: If I create a button in the child window and click it, the button has all the time focus, even when other child window are clicked. I cannot find any example of how to create child windows in a main window. I have over 40 books on VC++ but none of those explain this.
Thank you any suggestions
(The same problem occurs when children are created in SDI without Doc/View support).
Jerzy
|
|
|
|
|
One of my visual c++ books tells me that in order to control the showing and hiding of toolbars, create the View menu item with the same ID as the toolbar resource, and map the ON_COMMAND_EX to OnBarCheck and the update UI to OnUpdateControlBarMenu. This compiles, but it isn't doing a damn thing - the menu items aren't checked and selecting them does nothing. Has anyone else gotten this to work?
thanks,
Jake
|
|
|
|
|
Works fine for me, maybe you could post the code in question so we can take a look at it.
cheers,
Ben Burnett
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
I'm trying to get this message map code in my CMainFrame class to control showing/hiding my toolbars. I know the menu IDs are correct, because I changed the message map as a test to map to some functions I wrote, and they worked. This, however, isn't doing anything.
ON_COMMAND_EX(IDR_TOOLBAR1, OnBarCheck)
ON_COMMAND_EX(IDR_TOOLBAR2, OnBarCheck)
ON_UPDATE_COMMAND_UI(IDR_TOOLBAR1, OnUpdateControlBarMenu)
ON_UPDATE_COMMAND_UI(IDR_TOOLBAR2, OnUpdateControlBarMenu)
This is the only code related to this - do I need anything else? Is there a problem with the CMainFrame class handling this? Ideas?
thanks,
Jake
|
|
|
|
|
These are fine
ON_COMMAND_EX ( IDR_TOOLBAR1, OnBarCheck )<br />
ON_COMMAND_EX ( IDR_TOOLBAR2, OnBarCheck )
This wont work the way you expect it too. This is because your OnUpdateControlBarMenu() handler has no way of differentiating between the two toolbars.
ON_UPDATE_COMMAND_UI ( IDR_TOOLBAR1, OnUpdateControlBarMenu )<br />
ON_UPDATE_COMMAND_UI ( IDR_TOOLBAR2, OnUpdateControlBarMenu )
You'll need to use two functions to get the desired effect.
ON_UPDATE_COMMAND_UI ( IDR_TOOLBAR1, OnUpdateToolBar1 )<br />
ON_UPDATE_COMMAND_UI ( IDR_TOOLBAR2, OnUpdateToolBar2 )
-or-
You could use the ON_UPDATE_COMMAND_UI_RANGE macro.
void CMainFrame::OnBarCheck ( UINT nID ) {
switch ( nID ) {
case IDR_TOOLBAR1:
ShowControlBar ( &m_wndToolBar1, !m_wndToolBar1.IsVisible (), FALSE );
break;
case IDR_TOOLBAR2:
ShowControlBar ( &m_wndToolBar2, !m_wndToolBar2.IsVisible (), FALSE );
break;
default:
break;
}
RecalcLayout ();
}
void CMainFrame::OnUpdateToolBar1 ( CCmdUI * pCmdUI ) {
pCmdUI->SetCheck ( m_wndToolBar1.IsVisible () );
}
void CMainFrame::OnUpdateToolBar2 ( CCmdUI * pCmdUI ) {
pCmdUI->SetCheck ( m_wndToolBar2.IsVisible () );
}
That should get it working for you.
Ben Burnett
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
Thanks a lot for your help. It's finally working.
Jake
|
|
|
|
|
Does anyone know of a Windows Common dialog, or standardized way to display the user accounts on a Windows NT machine, so that a user can select permissions and such?
|
|
|
|
|
There is a standardized way to display this information, its called the User Manager. Do you really want to expose this to ordinary users? I would leave it up the administrator to assign rights and permissions.
|
|
|
|
|
In the registration process of this program Im working on, I would like to have it a dialog box where I (the administrator) can enter the username and password that the server will run under (yes I could do this in dcomcnfg, but I would like to put that functionality in my program as well). And while the user manager is a good way to display this information, I cannot get data selected from the user manager into my project, which is what I want. The "Browse for user" dialog box presented in dcomcnfg is the same dialog that is presented when you set the permissions on a file or folder, which is why I thought it might be a standard dialog box...That is that dialog box I would like to put up, and if theres a standard way to do it that would be best =)
|
|
|
|
|
Use Net* and Lsa* functions. For example NetUserEnum, NetUserChangePassword, LsaEnumerateAccountRights ... and many many other.;)
|
|
|
|
|
Sweet thanks...the Net* functions answer most of my question. Do you know if there is a way to bring up that seemingly standard "Add Users/Groups" dialog, with the combo box at the top, and the list box to display the users/groups? Ive seen the identical dialog box both in windows, and on separate applications, so I assume its standard in some way...
Thanks again
|
|
|
|
|
I have a sdi formview based app, and when the main form resizes, I want my listbox (which takes up the entire form) to resize with it. I tried overriding WM_SIZE, but it won't let me use...
m_ctrlListBox.SetWindowPos()
or
m_ctrlListBox.MoveWindow()
It crashes in both functions on ASSERT(::IsWindow(m_hWnd));
How else would I resize it?
|
|
|
|