|
Typically code I write here on CP is psuedo code, just to get you started on the right direction, I hardly never test code.
try this instead:
CFile myFile('test.dat', CFile::modeWrite);
CString buff;
buff = "This is some text";
myFile.Write(buff.GetBuffer(buff.GetLength()), buff.GetLength());
The word of the day is legs, let's go back to my house and spread the word
|
|
|
|
|
Try to write like this!
CFile myFile('test.dat', CFile::modeWrite);<br />
CString buff;<br />
buff = "This is some text";<br />
myFile.Write(str.operator LPCTSTR(),buff.GetLength());
Abhishek Srivastava
Software Engineer (VC++)
India ,Noida
Mobile no 9891492921
|
|
|
|
|
hi
Thanks for ur solution!!
But if u use above code..it is not giving any error while executing..but this writes our data with some junk value...So we can't retrieve it properly.
Cheers
JP
|
|
|
|
|
I developed a drawing application which draws colored rectangles,circles etc...when i place one object on other i need to see the beneath object and must change the transparency level from full transparent to opaque with the same color of the object...how can i do it...?
|
|
|
|
|
AlphaBlend() API or you will have to write you own or find pre-written code to do it for you.
There is probably something available here on CP under bitmap section if you look hard.
Cheers
The word of the day is legs, let's go back to my house and spread the word
|
|
|
|
|
I see this function in almost all wizard generated code and (maybe I'm a fool for asking), but what does this function do? I see the comments that say "The system calls this function to obtain the cursor to display while the user drags the minimized window". I've been using Windows for a while, but I've yet to be able to "drag" a minimized window. I'm thinking that a "minimized window" is one that's been minimized to the taskbar, and if that's correct how do you drag it?
Thanks.
- monrobot13
|
|
|
|
|
Left-overs from Windows 3.x. Basically irrelevant now, I believe.
|
|
|
|
|
Before Win 95, there was no Taskbar. Minimized apps became icons at the bottom of the screen, and you could move them around if you felt like it. WM_QUERYDRAGICON was sent when you started to drag an icon.
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | 1ClickPicGrabber New v2.0.1! | RightClick-Encrypt
"Linux is good. It can do no wrong. It is open source so must be right. It has penguins. I want to eat your brain."
-- Paul Watson, Linux Zombie
|
|
|
|
|
Ah, that would explain it. Would it be safe to remove the function then if I know for a fact that application wont be run on anything below Windows 95?
Thanks.
- monrobot13
|
|
|
|
|
|
Awesome. Thanks for the help Mike.
- monrobot13
|
|
|
|
|
Hi !
I've a class CModel containing a list a CPlane objects. The CPlane class has a method called changeOrigin(). The third class CModelViewer is a class displaying the CModel object as a treelist : the CModel object is displayed and the user can expand the CModel and see the list of CPlane contained in the CModel. When the user right-click on a CPlane, he/she can change the origin of the CPlane.
My question is, according to good design rules, how am I supposed to change the origin of the selected CPlane ? Should I change it in the CModelViewer, directly calling the changeOrigin() method of CPlane (but with this way, CModel won't know than one of its CPlane has changed), or should I implement a changePlaneOrigin() in the CModel class, call it from CModelViewer and let CModel change the origin of it's underlying CPlane ? (but with this way, each time I add a method in the CPlane class which would change the state of the CPlane object, I would have to add it in the CModel as well).
I hope I made myself clear enough and I'm looking forward to reading your suggestions !
Thanks !
Jerome
PS: Here is how the class would look :
class CModel
{
public:
CModel();
~CModel();
CPlane[10] m_PlaneList;
};
class CPlane
{
public:
CPlane();
~CPlane();
void setOrigin(Position NewOrigin);
private:
Position m_Origin;
};
|
|
|
|
|
If CModelViewer is a view for the CModel class it would be a good idea to do call a change method of CModel. In general it's not a good idea to make the CPlane array public in the CModel class.
An other solution may be that CPlane has also a view, e.g. CPlaneView. This view (and controller) would be a knot (item) in you CModelViewTree. Of course with this simple implementation CModel won't be informed if one of its CPlane objects changed. You may want to use the observer design pattern to inform CModel that a CPlane object has been changed.
|
|
|
|
|
I am trying to have the cross cursor apear when you press down the control key. In the MSDN it says that message controls the mouse message number. When I run this code it does not recignise the key.
BOOL CClusterSimulationView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)<br />
{<br />
if (message == MK_CONTROL)<br />
{<br />
hCursor = LoadCursor(NULL, IDC_CROSS);<br />
SetCursor(hCursor);<br />
}<br />
else<br />
{<br />
hCursor = LoadCursor(NULL, IDC_ARROW);<br />
SetCursor(hCursor);<br />
}<br />
return true;<br />
}
|
|
|
|
|
This works fine;
[code]
BOOL m_Cntrl = FALSE;
BOOL CtestView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
if (m_Cntrl)
{
::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_CROSS));
return true;
}
else
{
return CScrollView::OnSetCursor(pWnd, nHitTest, message);
}
}
void CtestView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if(nChar == VK_CONTROL){
m_Cntrl = TRUE;
}
CScrollView::OnKeyDown(nChar, nRepCnt, nFlags);
}
void CtestView::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if(nChar == VK_CONTROL){
m_Cntrl = FALSE;
}
CScrollView::OnKeyUp(nChar, nRepCnt, nFlags);
}
[/code]
|
|
|
|
|
can somebody give me the link to the latest Device development kit (DDK) for NT or win9X
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
|
sorry monty, you have to order it... no downloads anymore
Don't try it, just do it!
|
|
|
|
|
How would I get an application to register a keydown, keyup, or keypressevent thile it is minimized?
James Meade
vENS vUSN
vOPSOFF VAQ-140
|
|
|
|
|
Hey all.
I went and picked up a copy of VS .NET 2003.
One thing that I cannot seem to get rid of is the "outlining feature" of it. (Where it kind of looks like a "Tree View" and I can click on "+" and "-" on the left to expand/collapse "blocks" of code (such as an IF statement, or a CLASS method)
I went into "EDIT -> OUTLINING -> STOP OUTLINING" and that got rid of it. However, it comes back "sporadically". It always comes back on me after an error in the code (such as a misspelled variable name) ... but sometimes I'll just be sitting there and all of a sudden, WHAM it turns on as if I just turned it on.
I am wondering if there is an option somewhere where I can just say opposite of Nike(tm) "Just Don't Do It" (heheh)
Thanks in Advance!
-Shultas
|
|
|
|
|
Tools > Options > Text Editor > C/C++ > Formatting, then uncheck 'Enter outlining mode when files open' might help.
Repeat for other languages.
There doesn't seem to be an overall 'no outlining' option, sorry.
|
|
|
|
|
Hi,
My app uses an embedded web browser control. In order to print to specific printers, I change the default printer setting in the registery, and then use the following function to print the html...
ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, ...
My problem is that the web browser doesn't respond to the notification message...
SendNotifyMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)_T("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows"));
The only way I can make the web browser use the new default printer is to destroy and re-create the browser object. But this is quite slow.
Anyone got any better ideas?
|
|
|
|
|
Hi Joanne,
Did you ever find a solution to this problem?
-Jason
joanne_fredrickson wrote: Forum: C / C++ / MFC
Subject: Web Browser Control & WM_SETTINGCHANGE
Sender: joanne_fredrickson
Date: Thursday, January 22, 2004 5:31 PM
Hi,
My app uses an embedded web browser control. In order to print to specific printers, I change the default printer setting in the registery, and then use the following function to print the html...
ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, ...
My problem is that the web browser doesn't respond to the notification message...
SendNotifyMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)_T("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows"));
The only way I can make the web browser use the new default printer is to destroy and re-create the browser object. But this is quite slow.Sleepy
Anyone got any better ideas?
|
|
|
|
|
Hi,
I am writing a Point of Sale system. I have incorperated a dialog with a fullscreen dialog behind. The main window is just a normal dialog with topmost set.
In the initdialog I have a ShellExecute function to launch another app called Fullscreen.exe.
The reason I made a separate program was because I wanted this program to have a differant background colour to the main window.
What I want to know it how I can have the main window which I call CNPOSDLG as the very topmost dialog and then have the fullscreen dialog the second topmost dialog so that when I click into the CNPOSDLG it wont bring up the start menu down the bottom on top of the fullscreen window.
Also, how can I kill fullscreen.exe when I close my main program?
That sounded very umm.....confusing but I know what I am trying to say lol!
If anyone can help me, I'd really appreciate it!
Thanks
Ashman
|
|
|
|
|
Ashman wrote:
Also, how can I kill fullscreen.exe when I close my main program?
FindWindow() and send it an WM_CLOSE message. Thats what i would try anyways.
The word of the day is legs, let's go back to my house and spread the word
|
|
|
|