|
i thought that also .. but the problem is still not fixed
|
|
|
|
|
I have a program and in InitInstance i call a dialog in which i specify a file name for creating a new file and then i create this file calling CWinApp::FileNew.I need to know this file name in My doc class, more exactly in OnNewDocument.How can I do this? I desperately need help.F1!!!!!!!!My time is very short.
|
|
|
|
|
you should be available to get it through ((CYourMainAppClassNameHere*)AfxGetApp())->your_dialog_variable_name.string_variable, and you should update string variable on every change of file name
hope it helps at least a little
|
|
|
|
|
How can i update string variable on every change of file name?
Thanks a lot.
|
|
|
|
|
Edit box in which you enter the string should have an property function OnEdit or OnChange, which is called everytime when string is changed. Override this function and inside it call UpdateData(); which should update string variable to its current status.
|
|
|
|
|
1) After you get the file name from the Dialog create the
file using CFile or whatever.
2) In your (added) OnNewDocument function call
SetPathName("<the_path_you_got_in_1>");
e.g.
BOOL CMyDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
SetPathName("c:\\temp\\a.txt"); // c:\temp\a.txt should exist!
return TRUE;
}
This will not display a Save Dialog when you select "Save"
from the File menu. If I have not misunderstood your question
this should help!
Due Regards
Mahendra
|
|
|
|
|
the other responses are correct. my understanding of your statement is you are unable to access the file name from the My Doc class. one way to do this would be
declare a variable in your CMyWinApp class and copy the value of the path into it
now you can access this variable from your doc class by using.
(CMyWinApp*)AfxGetApp()->variable
|
|
|
|
|
So you are naming the file before the app starts as opposed to when it (or the document) ends? Is there a design reason for this, or am I missing something? Normally in an SDI or MDI application, the name of the file is selected when the document is closing (i.e., if IsModified() returns non-zero).
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Yes,this is what my boss is asking.
|
|
|
|
|
I am trying to link a static lib (*.lib) build on C compiler through nmake. It give me some funny errors duing linkage time.
Do I need to call extern "C" for each of the function that I need to use?
Or any remedies or reference for this.
thank you.
Sonork 100.41263:Anthony_Yio
Life is about experiencing ...
|
|
|
|
|
problem has been solved. It appears to be a file version problem.
Sonork 100.41263:Anthony_Yio
Life is about experiencing ...
|
|
|
|
|
Anthony_Yio wrote:
I am trying to link a static lib (*.lib) build on C compiler through nmake. It give me some funny errors duing linkage time.
What where the errors?
Michael
CP Blog [^]
|
|
|
|
|
Sorry friend, it appear to be a file version problem of mine.
Thanks you anyway.
Sonork 100.41263:Anthony_Yio
Life is about experiencing ...
|
|
|
|
|
Thanx.
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|
|
How about monitoring clipboard?
Sonork 100.41263:Anthony_Yio
Life is about experiencing ...
|
|
|
|
|
Tried that but you get events only when someone is trying to put some data into the clipboard and not when someone is reading it.
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|
|
How about
WM_DRAWCLIPBOARD
handler?
Sonork 100.41263:Anthony_Yio
Life is about experiencing ...
|
|
|
|
|
And hope that all windows preceeding the one with the handler passes the message on.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
If you've done API hooking before, hook the OpenClipboard(), SetClipboardData()
Search goole for "apispy32"
Bikram Singh
|
|
|
|
|
Hi Dear...
I struck in a problem & I know you can help me..
I've a pro-merchant account in amazon..& I want to upload Inventory to amazon.. but getting problem..File Error..even from site upload...
Can you send me Execl file you used for that uploading...
+ if possible some coding snippet of uploading invenorty. I want to upload through coding.. send me at:
sumit_kapoor1980@hotmail.com
or chat with me at hotmail account or yahoo: sumit_kapoor1980@yahoo.com
I hope you will help me..
Thanks
Have a Nice Life..
Sumit Kapoor.
---Sumit Kapoor---
|
|
|
|
|
plz can any one help me in deleting a Text file thru c or c++ vc++ program..
( i am using "ShellExecute(NULL, "del","c:\\res.txt",0, 0, SW_HIDE);" but this statment is not working.)
|
|
|
|
|
1.Windows API
BOOL DeleteFile(<br />
LPCTSTR lpFileName
);
2. MFC method
static void PASCAL Remove( LPCTSTR lpszFileName );<br />
throw( CFileException );
3. Windows Shell API
SHFileOperation()
I'd prefer the first way, but the 3rd way is powerful
|
|
|
|
|
I'm trying to draw a stetched image, but only the part that need updating, with the following code:
if (IntersectRect(&rcIntersected, &ps.rcPaint, &rcImgScrolled))
{
float rx = (float)ImgWidth / (float)ZoomedImgWidth;
float ry = (float)ImgHeight / (float)ZoomedImgHeight;
int dl = rcIntersected.left - ps.rcPaint.left;
int dt = rcIntersected.top - ps.rcPaint.top;
int dw = RECTWIDTH(rcIntersected);
int dh = RECTHEIGHT(rcIntersected);
int sl = int(float(rcIntersected.left - rcImgScrolled.left)*rx);
int st = int(float(rcIntersected.top - rcImgScrolled.top)*ry);
int sw = int(float(RECTWIDTH(rcIntersected))*rx);
int sh = int(float(RECTHEIGHT(rcIntersected))*ry);
StretchBlt(hDCBuffer,
dl, dt, dw, dh,
hDCCurImg,
sl, st, sw, sh,
SRCCOPY);
}
The problem is when the window is at certain sizes (the zoom is scaled to the window), the last row or column isn't drawn.
I know it's because of the floats being rounded off, but how do you fix so it gets the exact number of pixels needed?
I tried floor() which had no effect, and ceil() which would sometimes draw an extra row or column of random colors...
-thanks
|
|
|
|
|
did someone have this problem the other day?
my app hangs quite often when i try to debug
any suggestions?
|
|
|
|
|
hi,
i want to know any method i can use Visual Studio .NET to build application with old mfc class. so that i dont need to ship the mfc71.dll?
actually, i can build my convert and build old application in visual studio .net. however, it link to mfc71.dll. i dont want this. any help?
Thanks!
jim
|
|
|
|