|
I am trying to make a simple menu to run dos based programs. I can't figure out how to have the menu call the dos programs. I have read that there is a way to make stdout do this, but I can't find anything on this. Any help or advise would be great.
|
|
|
|
|
Try using the ShellExecute function to run your DOS programs, in the ON_COMMAND handler functions for each menu item. I never tried it for DOS programs, but it should work as well for DOS as Windows. You can find documentation on it in MSDN.
|
|
|
|
|
Hey guys
Does anyone know how to change a SYSTEMTIME in to a string that is for instance Febuary 12th 2001. I can't imagine there isn't a function to do this. So i would greatly appreciate if someone could tell me the name of the function.
Cheers
Peter
|
|
|
|
|
Try this:
SYSTEMTIME lCurrentDateTime;
char sFormatedDate[15];
GetSystemTime(&lCurrentDateTime); // get system date
GetDateFormat(NULL,
0,
&lCurrentDateTime,
"MMM dd',' yyyy",
sFormatedDate,
sizeof(sFormatedDate)); // format system date
Chris
campbell.chris@excite.com
www.SunAndGames.com
|
|
|
|
|
Yep that works, but you can also use the CTime or COleDateTime classes if you're using MFC.
SYSTEMTIME lCurrentDateTime;
GetSystemTime(&lCurrentDateTime);
CString strFormatted = COleDateTime(lCurrentDateTime).Format("%B %d, %Y");
CString strFormatted = COleDateTime::GetCurrentTime().Format("%B %d, %Y");
Regards,
Alvaro
|
|
|
|
|
It's bad to hard-code a date (or time or currency) format like that. Pass NULL for the format to have the API use the user's chosen date format.
--Mike--
http://home.inreach.com/mdunn/
While I can't be accurate on all matters, I can make the reassuring claim that where I am inaccurate, I am at least definitively inaccurate.
your with and
|
|
|
|
|
I've recently written a program that adds some new functionality to an existing off the shelf accounting program. I have no access to the source code of the accounting program. But, by using windows hooks within a DLL I was able to trigger the execution of my program when the user clicked on certain buttons within the accounting program. So, it appears to the user like I have actually modified the original program.
I would like to take this to the next level, and add my own buttons/controls to the screen of the accounting program. I've used functions like SetWindowsText, to change the text of another windows title bar, and FlashWindowsEx to flash another window. But, is there any way to actually add buttons/controls/menu items to the accounting program screens? I know this sounds kind of crazy, but it never hurts to ask.
The other approach I thought to take, would be to create my own window that anchors itself to the accounting program window, and place all the buttons/controls inside of it.
Any suggestions, or even crazy far fetched ideas are greatly appreciated.
Thanks, Chris
|
|
|
|
|
It sounds to me like you need two things:
1. Modify the app's existing resources, like menus, dialog boxes, etc.
2. Add your own functionality to your own menu items, buttons, etc.
Well, for the first point there's a nice tool I just read about in the Lounge (see, it helps to be a bum sometimes ) called ResourceHacker. That should get you started.
The second point you already have covered with hooks.
Regards,
Alvaro
|
|
|
|
|
Thanks Alvaro. Resource hacker is a cool tool. Just what I needed.
Chris
Chris
campbell.chris@excite.com
www.SunAndGames.com
|
|
|
|
|
Hello, the codegurus around the world.;)
I used to work the localization by loading the different langugage DLL.
So, this applies to your idea.
You can load the resource file by the different DLL.
If this DLL doesn't exit, the application loads the resource file in EXE file.
So, if you change something, (not add or delete the item from the resouce file), you can update only DLL without changing exe file.
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
Interesting stuff.
But creating your own modeless control box would seem to me as the safer option. Otherwise in future upgrades to your off the shelf software you may have to start from scratch. It would only take a change in menu structure or a remodel of the codes modular structure to bugger you up otherwise.
We do it for the joy of seeing the users struggle.
|
|
|
|
|
Hello,
I'm working on an MFC Application.
I would like to have a command line window where I can use tcl to call some functions , and call some tcl scripts.
Do you have any advice ?
Thanks,
Stephane
|
|
|
|
|
Hi All,
When you delete records from tables in a .MDB database file, the record space is marked as available, but is not removed from the file. So the file size grows over time.
As near as I can tell, the only way to reclaim that space is to compact the database. It would be really nice if the "available" space could be re-used by new records, but it doesn't look like this can happen. It would also be nice if you could compact just a single table in the database, but again, it looks like you have to do the whole .MDB file.
To compact a database, you must have exclusive access to it, and it must be closed (so how do you tell other applications to drop their connections to it?).
The database file must be compacted to a temporary file, and then the original deleted, and the temp file renamed.
This is a major pain when you have an application that is running ALL the time (and also when there are other apps also accessing the .MDB file).
Does anybody know of a way to reclaim the "available" space in a .MDB file, either by have the space be re-used for new records, by compacting only a table within the database, or by being able to compact the database without having to shut EVERYTHING down?
Thanks VERY much!
- Sean
|
|
|
|
|
I don't believe that can do that...
I think that is better pass to SQL Server, or to My Sql, it last one is very cheaper...
best Regards....
Carlos Antollini.
|
|
|
|
|
This is a Visual C++ app, using a CDaoDatabase (and the Jet engine).
My current solution is to check the database size at startup, and prompt the user to see if they want to perform a compaction if the database is larger than a certain threshold. The user is also prompted to shut down other applications which may be accessing the database.
The problem with this solution, is that it forces the user to periodically shut down and re-start the application (as well as other applications).
To do the compaction, I use the CDaoWorkspace static member function CompactDatabase. This works, but I wish there was a better solution.
Thanks - Sean
|
|
|
|
|
Yes I know that.
I worked with DAO several years, but the problem is that you need the database in exclusive mode for compact it. Is for this that I said you that I don't know if exist any solution, CDAOWorkspace need that nobody have the database open, for compact it.
May be Acces 2000 has some commands like SQL has but I don't Know....
Best Regards....
Carlos Antollini.
|
|
|
|
|
Hi all,
I wanna when user hited one of columns in the list control, program select all rows below the column !
and how can i understand user hited which column in list control ?
How can i do that ?
(Excusme about my English)
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
|
Thanks for your helps
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
I have a MDI application where the child windows are formviews of a single document. I would like to force the closing of the open document before a new document can be created or another document can be opened. I would like the document closing to follow the normal MFC close document operation of checking to see if the file is dirty and prompting for the user to save. After the user has taken the necessary save steps, the user would be presented with the standard MFC File NEW or File OPEN screens.
So far my attempts to use OnCloseDocument to force the active document to close have led to Assertions when CWinApp::OnFileNew is finally called.
All suggestions appreciated.
|
|
|
|
|
I'm not sure what you did in OnCloseDocument, but from the description of the problem, it sounds like you need to do some work in OnFileNew and OnFileOpen.
Specifically check the dirty flag, save the existing document, close the windows etc.
Hole this helps,
Bill
|
|
|
|
|
I did not override OnCloseDocument. I was trying to call it from my OnFileNew and OnFileOpen handlers in the main application class. I was doing this by getting a pointer to the only document open then calling the base class CWinApp::OnFileNew(). I finally got something working this evening. It looks like this:
afx_msg void CMyApp::OnFileNew( )
{
POSITION docPos = myTemplate->GetFirstDocPosition();
if (docPos != NULL)
{
// This is necessary because I will send a message to myself to call
// this handler again.
if (!iWasJustHere)
{
// force the standard close document handler
AfxGetMainWnd()->SendMessage(WM_COMMAND, ID_FILE_CLOSE, 0);
iWasJustHere = TRUE;
// Send a message to call this handler again because if I fall
// through and execute my base class OnFileNew the close will
// not have completed and my window handler gets messed up.
AfxGetMainWnd()->SendMessage(WM_COMMAND, ID_FILE_NEW, 0);
}
else
{
// we tried to close the document but the user chose Cancel
// in the standard ask user if they want to safe changes dialog.
iWasJustHere = FALSE;
}
}
else
{
// At this point we have closed any open document and can create
// a new one.
iWasJustHere = FALSE;
CWinApp::OnFileNew();
}
}
You can repeat this process for OnFileOpen() by replacing CWinApp::OnFileNew with the appropriate base class handler. I don't think it is necessarily the best way to handle this problem. But it was the only way I could find that worked without having to override the standard dialogs.
Interested in hearing your thoughts on this approach....
|
|
|
|
|
Hi all!
does any one ever have problems with CTreeCtrl::GetSelectedItem() function? I try to use this function to obtain the handle to the selected node in my tree. However, this function keeps returning me a null handle or wrong handle. Please advise if you have anything to say
Any help is really appreciated.
Thank You
Vu
vucsuf
|
|
|
|
|
Please post tree initialization and mentioned function code.
Tree control could fail to create for example.
|
|
|
|
|
The function GetSelectedItem() is fine. The problem is how I used it. I called it in my OnClick event. This function does not work correctly with onClick event. IT does work fine with OnSelChanged event.
I still don't have a good explaination on this issue. Does anyone know?
Vu
vucsuf
|
|
|
|