|
Hi, I want to open a file in a folder which is different from the folder where the application resides. I used fopen but the file still is created in the same place.How to change the destination of the file?
Thanks,
Deepak Samuel
|
|
|
|
|
Did you try to simply state the full path to the file in the 'fname' argument to fopen? Something like:
"c:\\dir1\\dir2\\myfile.ext"
/=/=/=/=
Deus
/=/=/=/=
|
|
|
|
|
Post the code that creates the new file.
Kuphryn
|
|
|
|
|
Well... in our application, we've changed the resolution dynamically, when the resolution was too small to show the whole dialog.
In WinNt4.0 there weren't any problems, in Win2k strange things occur (it seems that the WM_DISPLAYCHANGE message isn't sent.. cause the toolbar stays at the position [looks like it is floating around on the screen)
the code
[pre]
void CMainFrame::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)
{
CFrameWnd::OnActivate(nState, pWndOther, bMinimized);
// TODO: Add your message handler code here
if(nState == WA_INACTIVE)
ChangeDisplaySettings(NULL, 0);
if(nState != WA_INACTIVE){
DEVMODE* pDevMode;
pDevMode = new DEVMODE;
pDevMode->dmSize = sizeof(DEVMODE);
// dm.dmDriverExtra = 800;
if(EnumDisplaySettings(NULL,ENUM_CURRENT_SETTINGS, pDevMode )){
DWORD dw_width = pDevMode->dmPelsWidth;
DWORD dw_height= pDevMode->dmPelsHeight;
if(dw_width < (unsigned int)pParameter->GetInt ("XPixel")){
pDevMode->dmPelsWidth = pParameter->GetInt ("XPixel");
pDevMode->dmPelsHeight = pParameter->GetInt ("YPixel");
long l = ChangeDisplaySettings(pDevMode, 0);
}
delete pDevMode;
}
}//if(!WA_INACTIVE
}
[/pre]
Any ideas ?
"I'm from the South Bronx, and I don't care what you say: those cows look dangerous." U.S. Secretary of State Colin Powell at George Bush's ranch in Texas
|
|
|
|
|
Hi,
I have created an Explorer extension to provide a custom column.
This column is quite happy being turned on and off on a per folder basis in Explorer - I can tell any particular folder whether to display the column.
Now, in my application, I want to do a file open dialog (CFileDialog, GetOpenFilename() etc).
This is all ok and after no small effort I have managed to get this dialog to use the 'Report' view by default for the ListView control.
The problem is that the dialog only shows the default columns (Name, Size, Type etc...) and pays no attention to the individual folder settings - thus my column is not displayed even if the particular folder is supposed to be showing it.
I can select the column to be displayed in a folder but then if I browse to another and return the column settings have disappeared.
If I tell every folder to display the column (Tools-Folder Options-View-Like Curent Folder) then the column wil be displayed in my file open dialog. However, I don't want this column to be displayed for every single folder in Explorer (I intend adding quite a few more columns which show information inappropriate to most folders).
I know about the SHELLDEF_View and SysListView32 classes that implement the ListView control and can get to the interfaces below:
IID_IShellFolder2
IID_IShellIcon
IID_IPersistFolder3
IID_IShellIconOverlay
None of these interfaces appear to have methods that allow me to manipulate the columns shown. I know I can manually add columns with ListView.InsertColumn() but then there is no way of populating the control properly (or is there?) and it seems to blow up if I try and change views.
Does anyone know of a way of telling the control which columns to show, and to get it to remember which columns are to be shown. I know it can be done (Visual Studio.net has a dialog such as I need but it's quite possible that that uses it's own which just happens to be very similar to the standard dialog) but how?
I really cannot believe that one of the most used dialog boxes in the known universe is such a pain in the ar** to use (well obviously I can but even so...).
Do I have to implement my own IShellView + place it over the top of the standard one? This would be annoying due to having to implemnent the sorting, right click etc.
Thanks for any help on this particularly matter because it's driving me up the wall : )
Rick Dangerous
|
|
|
|
|
I have been struggling over this and I have come to the conclusion that the CRichEditCtrl is NOT a true WYSIWYG control.
To see this, create a control that is say 4 inchs wide by 1 inch deep. Now use the SetTargetDevice to attach the control to your default printer, set the font of the control to be 12 pt Times New Roman. The only thing that SetTargetDevice will do is have the control look like it will print for the word break. It will not make the text within the control look like it will when it prints (spacing wise).
Now draw a rectangle around the control (have the rectangle several pixels bigger in each direction from the control, since the control will overwrite the rectangle on the screen if they are the same size.
If you type some text into the control, when it wraps, you may notice that where the text wraps and the area to the end of the control seems too big and could contain some text. When I first saw this, I was wondering if I didn't correctly calculate the width for the SetTargetDevice. But, when I printed, the text went up to the end of the control next to the right side of the rectangle (well, not all the way).
Now if anyone can show me how to make the text spacing within the control look like it will print, please do!
Larry J. Siddens
Cornerstone Communications
TAME THE DOCUMENT MONSTER
www.unifier.biz
|
|
|
|
|
i want to add unicode support to my project.
for example i changed atoi to _ttoi.
please tell me which macro is equivalent with atof.
|
|
|
|
|
|
you don't have a ready-made macro, but you can use _wtof instead of atof. Define your own macro to deal with it.
/=/=/=/=
Deus
/=/=/=/=
|
|
|
|
|
How to abort reading operation on blocking socket? WSAAsyncSelect doesn't work.
|
|
|
|
|
What do you mean WSAAsyncSelect does not work? WSAAsyncSelect is a non-blocking I/O model.
Kuphryn
|
|
|
|
|
He means following situation. There are 2 threads. One thread sets the socket to blocking state and starts to receive data. Let the next recv() function blocks the socket. The second thread wants to terminate this operation. What should it do? Calling AssyncSelect() from the second thread doesn't set the socket back to non-blocking mode.
|
|
|
|
|
All is OK now. Sockets set back to non-blocking mode after a few seconds - use select()
|
|
|
|
|
Hi, how do I use the RichEdit 4.1 control? I have XP sp1 and the msftedit.dll file exists on my machine. I don't know the class name I should use... RICHEDIT20W or RICHEDIT20A doesn't work.
/=/=/=/=
Deus
/=/=/=/=
|
|
|
|
|
sagmam wrote:
how do I use the RichEdit 4.1 control?
The same way you'd have used the RE library in the past. Each one is a superset of the previous one (with the exception of new functionality, only the name of the DLL changes). After calling LoadLibrary() , you can then use the API just like normal. Assuming you already knew all that, the different between RICHEDIT20W and RICHEDIT20A is that the former is for Unicode and the latter is for ANSI.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
That's what I thought too... I used the Unicode version of RE (I'm developing an international app) by manually entering RICHEDIT20W in the .RC file of VStudio. I loaded msftedit.dll in my InitInstance(), and nothing happened - the app didn't open. That's the same symptom as when not initializing a rich-edit control. I'm assuming that I use the wrong class name, since its the only thing that doesn't explicitly exist in any documentation I've encountered. All docs that are relevant for RE v2 or v3 don't seem to work with 4.1. Any suggestions?
/=/=/=/=
Deus
/=/=/=/=
|
|
|
|
|
What does LoadLibrary() return? If you remove the control from the .RC file, does the app start? Do you have any non-XP machines to test on? If so, change the library being loaded to whatever is on the other machine (e.g., "RICHEDIT").
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
LoadLibrary() returns 0x9000000 (not NULL).
I remove the control, everything loads.
On win2K, if I use riched20.dll, it works great.
If I use class name "RICHEDIT" and riched32.dll (or AfxInitRichEdit), it runs (but no multilanguage support).
Did you successfully use this control? If so, can you send me some piece of code that works? Thanks...
/=/=/=/=
Deus
/=/=/=/=
|
|
|
|
|
sagmam wrote:
Did you successfully use this control?
No, I've never used Windows XP. Just for grins, have you tried "RichEdit20A" or "RichEdit20W" in the .RC file?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Of course... This is the standard procedure when working with RichEdit 2.0/3.0...
/=/=/=/=
Deus
/=/=/=/=
|
|
|
|
|
So all of these variations of case produce the same results:
RichEdit20A<br />
RichEdit20W<br />
RICHEDIT20W<br />
RICHEDIT20A<br />
RichEdit20a<br />
RichEdit20w
??
The only other thing I can suggest is to send a message to this person as he has been chest-deep in rich edit code the past few months. Maybe he has some other ideas to try.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I've tried all of the combinations above. I also tried RichEdit41W and other weird things
How do I technically send a message to this person?
/=/=/=/=
Deus
/=/=/=/=
|
|
|
|
|
sagmam wrote:
How do I technically send a message to this person?
At least three different ways I can think of to send a message to someone:
Find one of their posts and click the Email link instead of the Reply link.
Go to the person's bio page and start a New thread link.
Sometimes the person will include their e-mail address on their bio page.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
The class name for Richedit 4.1 is RICHEDIT50W - and only unicode is supported.
|
|
|
|
|
I am developing an application using vc++,MFC AppWizard ,Dialog form. I have a Dialog box on which I have put an Excel sheet Control. I would like to know how to access the control.
|
|
|
|