|
My program opens a file like this:
myFile.Open(Data[i].FileToModify,CFile::modeCreate | CFile::modeNoTruncate | CFile::modeRead,&fileException))
It works fine for me and most other people, but 3-4 (one using ME; others, I don't know) people have reported getting error #5 (ERROR_ACCESS_DENIED) when doing that. What could be causing that? I'm at my wit's end
|
|
|
|
|
Try
myFile.Open(Data[i].FileToModify,CFile::modeCreate | CFile::modeNoTruncate | CFile::modeRead|CFile::shareDenyNone ,&fileException))
Brian
|
|
|
|
|
Thanks, that works!
Now, why do most people not need that flag, but some do?
|
|
|
|
|
Is the only way to include images in your control?
I have to have a edit control that displays text and images. Sort of like the message window of a messenger (that displays text and smiles).
Is there a way to display images in a RichEditCtrl?
-----
We are what we repeatedly do. Excellence, then, is not an act, but a habit.
|
|
|
|
|
http://www.codeguru.com/richedit/rtfbitmap.shtml
|
|
|
|
|
Hello.
I´m working with MFC over NT. I´m using the CWorkQueue (threadpool) http://www.codeproject.com/useritems/Work_Queue.asp.
My problem is very easy to see. When an exception thrown inside of a thread my application finishes. It is because i can´t catch the exception with the common try{}catch{} block.
Anybody can help me?????
I am desperate
thank you very much by its time
|
|
|
|
|
|
When closing the last MDI Child windows, the document should close (as far as I understand).
When/Where does the MDIFrame window gets notified and changes the menu to the default menu when no document is loaded ?
Thanks.
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
>When/Where does the MDIFrame window gets notified and changes the menu to the default menu when no document is loaded ?
CChildFrame (CMDIFrameWnd::OnUpdateFrameMenu) is responsible for switching MDI menus.
I think it would be easier to catch "ID_FILE_CLOSE" & count docs ....
Brian
|
|
|
|
|
Dear all,
I would like to ask if it is possible to have a template function as a general function for two functions that have a different return type.
For example:
int AddNumbers(int a, int b);
float AddFloats(float a, float b);
What would it be the template function for the above example?
Regards,
grscot
|
|
|
|
|
template <class T> T Add(const T &a, const T&b)
{
return a + b;
}
|
|
|
|
|
Hi Roger
As you said in an article that I recently read, you're the printing guru.
I've got a problem and I don't know if you could help me.
PRECONDITIONS
I have to print an undetermined number of pages.
I have a determined number of files from where I get the data to print in order.
The data print is variable (sometimes could fit in a page, others half a page, others more than 1 page).
I have to optimize to fit the maximum number of data on the minimum number of pages ( if I could fit 2 data files in a page I have to do it)
How can I manage this? From where?
Best Regards
|
|
|
|
|
Sounds like a tricky problem.
The first thing I would recommend is you have some code that loads in all the files you will need to be printing. You can store these in a vector of objects. The object needs to support a call that tells how much space it will need when it prints - this probably needs to be in lines or pixels (depends on what each object is). Once you have their sizes, you could write an algorithm that groups together those items which can be placed on the same page where possible (this also depends on the page size landscape/portrait etc)
Once you have them put together into page blocks you will be able to calculate the number of pages you will have to print and hopefully print them too.
As your algorithm for working out what goes on each page needs to be properly optimized. I would get the items just printing as a square block with an ID number inside. Then if you get preview up and running you can try tweaking the layout engine until it gives the best results.
As your question is just a general overview I can't really be more specific.
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
Thanks Roger
I was thinking in something like this ( a lot of work!!!!) but I think that is the only way.
Best Regards
|
|
|
|
|
I have a CFormView based project that cleans out the system. For example, it deletes cookies, and temp files. When I run the program, the user can select checkboxes and click on a button to wash.
Is there any way to adjust the program so when the user clicks the .exe file, my program reads the command and does the wash automatically without opening the actual program?
|
|
|
|
|
azi_games wrote:
my program reads the command and does the wash automatically
Yes, this is easy and commonly done. You can store parameters for program in INI file, in Registry, or even read them for command line - see XGetopt for an example of reading command line.
azi_games wrote:
without opening the actual program
I do not understand what you mean. If the user clicks on a program, he expects to see something happen. If nothing happens, he will probably click again. After three or four times, he will probably think your progam doesn't work, and will delete it from system.
Of course, if this is really what you want to do, then there are ways to make a program invisible - e.g., on NT, make it a service. Or make your program's main window the child of an invisible window - it will not even show in the taskbar.
Best wishes,
Hans
|
|
|
|
|
I mean that the program does something without opening up the window.
I have found some information about this but it still is not clear to me.
BOOL CMyApp::InitInstance()
{
LPSTR lpszCmd=GetCommandLine();
// parse lpszCmd
if(command_line_keys_detected)
{
// do all your tasks here
return FALSE;
}
//
// original body of InitInstance
// goes here
//
}
I'm getting command_line_keys_detected error: undeclared identifier.
I don't know how this is supposed to be declared.
Thanks.
|
|
|
|
|
It's a variable. It needs to be declared just like any other.
|
|
|
|
|
Hi,
I have two CTime objects.
I need to determine how many days separate the two dates these objetcs represent.
How could I do this?
Thanks!
-- narada
|
|
|
|
|
Create a CTimeSpan var and initialize it with the difference between the two times. After that, use GetDays in the CTimeSpan object.
|
|
|
|
|
Yes, thanks a lot!
that's what I needed!
|
|
|
|
|
I've been doing some work with IShellFolder and related shell interfaces, working mostly with PIDLs. I did some tests, and saw that the DWORD cast of a PIDL was the same for particular folders. My gut tells me that these pointers are calculated using each folder's ID, token if you will. Does anyone who has more experience with these know for sure if they are persistent for each folder/file/virtual folder in the Namespace?
|
|
|
|
|
Hi there
I'm trying to refactor some old code, and in the process I'm introducing a dll, that's to be used from atleast 5 app's. The exe's has som objects with operations on them that i want to call. And I run into troubles. And I cannot figure out how to make a funktion call from an mfc extension dll to an exe.
Please hint me.
thanks
kenneth
app,dll,exe,call
|
|
|
|
|
How about passing the DLL a pointer to a static or global function from the main process?
Kuphryn
|
|
|
|
|
well, i'm just not happy with globals, but it might be the only way.
I was hoping on something like an COM emulated solution, through interfaces or
just through instances.
k
|
|
|
|