|
deostroll wrote: Snippet 2 doesn't work! Why is that so?
I don't really know MFC that well, but I guess the CMyDialog() constructor returns a pointer to a new object. Sorry, senior moment there, new returns a pointer to the object created. You can check what actually happens when you run your app by using the debugger.txtspeak is the realm of 9 year old children, not developers. Christian Graus
modified on Friday, February 12, 2010 12:11 PM
|
|
|
|
|
Richard MacCutchan wrote: If I am running an app on my PC and select a menu item which pops up a dialog box, and then press a button on that dialog which pops another dialog, I tend not to feel too kindly towards the designer.
Really? This sort of thing happens all over Windows (XP and Vista), Office (2003 and 2007), IE (6 and 8), Visual Studio (6 and 2005), etc."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
DavidCrow wrote: This sort of thing happens all over Windows, Office, IE, Visual Studio, etc.
Strange, it doesn't on the versions I have!txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Hi All,
Is it possible to open the file twice? I am using CStdioFile, i created two objects of type CStdioFile and assigning the same file for both the objects. one file opened for writing(modeReadWrite) the data and the other file opened for reading(modeRead) the data. In this case my application is crashing. please give me some solution.
CStdioFile obj1;
CStdioFile obj2;
obj1.Open("file1.txt", CStdioFile::modeReadWrite);
.....
.....
.....
obj2.open("file1.txt", CStdioFile::modeRead);
.....
.....
obj2.close();
....
...
obj1.close();
Thanks in advance!
Regards,
Anil
|
|
|
|
|
Why do you want to do such a thing ? Why don't you simply open and read the full file in memory, make the changes in memory and then write back everything to the file afterwards ?
|
|
|
|
|
|
Member 4399771 wrote: In this case my application is crashing.
At what point?"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Yes you can, simply use 2 handles (or objects or whatever your language wants you to use). Be aware of the folloing:
- The OS sees this as file sharing, so open in shared mode.
- You will have 2 independent filepointers.
Rozis
|
|
|
|
|
To Cedric and David: There are many cases opening a file twice can be handy. The simplest example is a Word document on a network. The first user reads it shared, read-write, the next shared, readonly. Be aware many DBMS use this for concurrent access (with some intelligence around).
Rozis
|
|
|
|
|
Hi..
In CView application I am showing a dialog(Like toolbar/ Status bar).
I have to change the dialog background color.
I used the following code. But background color not changing. If i use this same in new dialog application the background color is changing.
ON_WM_ERASEBKGND()
BOOL CTech::OnEraseBkgnd(CDC* pDC)
{
CRect rect; GetClientRect(&rect);
CBrush myBrush(RGB(255, 0, 255));
CBrush *pOld = pDC->SelectObject(&myBrush);
BOOL bRes = pDC->PatBlt(0, 0, rect.Width(), rect.Height(), PATCOPY);
pDC->SelectObject(pOld);
return bRes;
}
How to solve this problem.
Any help will be appriciated..
Thanks...G.Paulraj
|
|
|
|
|
I do not think that this is the message for the dialog's background repaint. Take a look at the WM_CTLCOLORDLG[^] notification. txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
It is working fine in form based applications... G.Paulraj
|
|
|
|
|
Paulraj G wrote: It is working fine in form based applications...
What has that to do with a Dialog? Did you follow the link I posted, and try using the methods suggested by Microsoft?txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Hello,
I am using VS2008 and OS Win XP. I create one application and uses the following function for writing the CD and it works fine.
SHGetFolderPath();
CoCreateInstance();
pICDBurn->HasRecordableDrive();
pICDBurn->GetRecorderDriveLetter();
pICDBurn->Burn();
When i deploy this application on OS Windows 2000, these function fails.
Is Win 2000 does not support this API or functions?
If i have to write CD in win 2000, what changes i have to made in this application or any other way to write CD?Abhijit
|
|
|
|
|
Usually error handling is helpful in such cases.
However, reading the
Minimum operating systems=Windows XP
info in the documentation [^], is priceless.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks for your help.
Is there any other way to write CD on Win 2000?
|
|
|
|
|
Probably there is, unfortunately I haven't found it (for instance IMAPI too are not supported).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
How to hide the dialogbox in win32. I tried ShowWindow(hWnd,0) in Initdialog()but fails to hide.
|
|
|
|
|
you can only hide a dialog if you have already created it.
A simple way is to only create a dialog if it has to be shown Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
KarstenK wrote: A simple way is to only create a dialog if it has to be shown
I think the OP wants a hidden dialog.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
If the dialogbox is the main window of your application look for the m_nCmdShow member of your CWinApp class. This member could be set in the InitInstance() method of your app.
Here is an article about it: A Simple Method to Control the Startup State of an MFC SDI Application[^]
If it is not the main window try to remove the WS_VISIBLE style from your dialog template.
|
|
|
|
|
Handle the first WM_PAINT message and call ShowWindow(hWnd, false); there. Because that's the first message that will be posted to the dialog after it's created.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
If you are using MFC, see the first part of this article."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hello,
I created one application in MFC using Visual Studio 2008. I want to run this application exe on OS Windows 2000. When i run this, it gives error about .dll files.
How can i run this application on OS Windows 2000?Abhijit
|
|
|
|
|