|
Maybe this will be disappointment for you but child window cannot have menu. Since dialog bar is a child window (either main frame or floating frame) it will not show menu.
JohnCz
|
|
|
|
|
How does one implement undo functionality in a Vc++ environment . Always is a definete wish list thing but dont have a clue as to how to implement it .
Engineering is the effort !
|
|
|
|
|
I would start by typing "Undo" (sans quotes) in the search bar on the top of this page (directly under Bob) and read the articles that are listed.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
since "undo" is a vast and sometimes complex domain, I suggest that you examine the following :
Undoing an operatation depends on the way the operation was done initially.
for example, you do a "create something" operation/command, the undo operation/command might simply be a cut or a remove, or worse, an "uncreate something"; do after that, if you go furher, what is the undo of the undo ( redo ); is it do a "create something" again ? or a paste or something ?
in my opinion, a good undo/redo system depends on the way you handle the different commands ( or actions) in your application.
for example, in a DB, you create a new record, the command that creates the record should contain as much context as possible so that you can recreate the record without any user action.
if you look from the other side.
you remove a record and do an undo, what is the result command ? is it a "create record" or something like a "paste" ?
...
so there are a lot going on here...
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Im having this wierd problem regarding outputing a file in the same path as the .exe, whenever i save the settings for my app it always save it to the desktop i have no idea why...its suppose to save it in the same path as the exe.. this is the first time ive had this kind of problem, this is almost the same code i always use and yet its not working the way it should be i dont know why..
heres the code
heres the defined values:
#define FILENAME_S "settings.ini"
#define STRINGi "Font=%s\nFont_Size=%d\nShow_Margin=%d\nShow_Toolbar=%d\nShow_Workspace=%d\nShow_Status=%d\nFile1=%s\nFile2=%s\nFile3=%s\nFile4=%s"
This is part of this FILESTUFF CLass
int FILESTUFF::saveIni( SETTINGS *st )
{
FILE *file;
if( ( file = fopen( FILENAME_S, "w+" ) ) == NULL )
return 0;
stripSpace( st->font, 1 );
stripSpace( st->file1, 1 );
stripSpace( st->file2, 1 );
stripSpace( st->file3, 1 );
stripSpace( st->file4, 1 );
fprintf( file, STRINGi , st->font, st->fontSize, st->showMargin, st->showToolbar, st->showWorkspace, st->showStatusBar, st->file1, st->file2, st->file3, st->file4 );
loadIni( &*st );
fclose( file );
return 1;
}
int FILESTUFF::loadIni( SETTINGS *st )
{
FILE *file;
if( ( file = fopen( FILENAME_S, "r+" ) ) == NULL )
return 0;
fscanf( file, STRINGi , st->font, &st->fontSize, &st->showMargin, &st->showToolbar, &st->showWorkspace, &st->showStatusBar, st->file1, st->file2, st->file3, st->file4 );
stripSpace( st->file1, 0 );
stripSpace( st->file2, 0 );
stripSpace( st->file3, 0 );
stripSpace( st->file4, 0 );
return 1;
fclose( file );
}
I have no idea
|
|
|
|
|
If you only specify the file name, not the entire path as you are doing, then the file will be opened in the current working directory which is not necessarily the same as app's installed directory. To ensure the file is saved in the directory you want it in always specify the full path.
You can use GetModuleFileName() to get the path to the exe.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
Yeah i can use that function, but there must be an explanation why this is happening, and my current working directory isnt my desktop so it wont be that.. there must be some thing else i did wrong just dont know wht it is...
I have no idea
|
|
|
|
|
RealityGamma wrote:
...and my current working directory isnt my desktop...
How are you verifying this?
As has already been mentioned, if you do not specify an absolute path, a relative path is assumed.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I am trying to change an ISAPI Extension so it uses Thread Pooling.
I've downloaded the sample from Microsoft and able to get it running.
The problem I am encountering has to do with the AfxBeginThread
function and a Runtime Class. I don't know how to let the class know
how to pass any parameters through the UI thread.
The unconverted ISAPI Extension uses this call:
CClientSession* pWinThread =
(CClientSession*)AfxBeginThread(RUNTIME_CLASS(CClientSession));
Whereas the sample uses:
CWinThread* pWinThread =
AfxBeginThread((AFX_THREADPROC)ThreadProc, m_hIoPort);
Note the MS Example AfxBeginThread uses the ThreadProc overload, the
existing project however uses CClientSession, which inherits from
CWinThread.
How can I let the CClientSession thread know about m_hIoPort the I/O
Completion Port?
<signature>
It's good to live,
Josef Wainz
Software Developer
|
|
|
|
|
The AfxBeginThread function has a parameter called dwCreateFlags . Set the value of that parameter to CREATE_SUSPENDED , set any of the threads member variables to whatever you want then call CWinThread::ResumeThread to run the thread.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
Hi all,
can anyone tell me if it is possible to automate MS Access so that I can perform the following tasks from my C++ application:
Open Access
Create a new database
Add a table
Add columns to table
Add data to table
Close table
Close database
I've done similar things for Excel and PowerPoint but can't find any examples on how to do this for Access (I've got as far as getting Access to open, but that is it).
many thanks,
Andy
|
|
|
|
|
Using Automation, just add classes from the msacc9.olb type library. Is there some reason why you can't use ODBC? One of its benefits is that Access is not required to reside on the target machine.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
thanks DavidCrow,
unfortunately the program we are coding has a lot of legacy code and libraries in it which clash with a lot of new libraries. We have found that we can use the automation features in Office which don't cause these clashes.
I've already added the type library however I'm not sure the order in which I create the various objects and also what (if any) parameters I need to pass into their constructors. If you could give me any guidance on this it would be most helpfull.
cheers,
Andy
|
|
|
|
|
Unless you are needing something specific from Access (e.g., form, query, report), I think it would be easier to use DAO. Look in the C:\Program Files\Common Files\Microsoft Shared\DAO folder for the type library. Unfortunately the only example I could put together is in VB.
It's helpful to use VB's Object Browser and the C:\Program Files\Common Files\Microsoft Office\Office\1033\Acmain9.chm help file for figuring out classes and objects from the type library.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Yes these are all possible. There are some good articles with ADO classes to facilitate this by Carlos Antollini in the database section.
|
|
|
|
|
I'm trying to load a .db file as a custom resource and then write it out at runtime. I can load the .db and get a resource id and it builds fine, but can't figure out how to write the file out at runtime.
Is this even possbible?
Thanks in advance,
Ron
|
|
|
|
|
Some months ago I used this code to write a resource to a file:
FILE *outfile;
if (outfile = fopen(OutDLL, "wb"))
{
fwrite(dll, 1, dll_size, outfile);
fclose(outfile);
}
dll is a void* -pointer to the resource, dll_size the size of the resource
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thanks,
What I don't understand is how to address the resource. For example, I have a resource ID IDR_DB that I loaded at design time. How do I read it so as to write it to a file.
Thanks for help,
Ron
|
|
|
|
|
rlepine wrote:
Is this even possbible?
Yes. See here for an example.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Appears to be just what I needed.
Thank you very much,
Ron
|
|
|
|
|
hi
What do I have to do to maintain the layout of a Form when I maximize the window?
Is it possible to desig the GUI working in a window that is 50% smaller than the final GUI and configure the window to maximize when executing such that all the containers in the form maintain its position in relation to the borders AND resizes. (i.e. if I maximize the window from 50% to 100& I want all the containers to double in size as well)
doneirik
|
|
|
|
|
(assuming you're using MFC/win32 UI code )
you need to handle the resizing of the UI manually, handle the WM_SIZE message and resize and reposition each control.
or you could use a layout manager, have a look here at CP for different layout managers.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
|
Hi all,
i need your help urgently.
i am facing problem with posting a DoModal FileOpenDialog from property sheet. i will explian my problem this way.
I hava a dialog D1 derived from CDialog. in its OnInitDialog(), i created a propertysheet PS1 at run time with D1 as parent, and PS1 having WS_CHILD | WS_VISIBLE as creation styles. PS1 has 2 propertypages - PP1, PP2 - added to it. PP1 has OPEN button. On Clicking OPEN, i need to post FileOpenDialog Box. My code is as below:
D1.cpp
-------
BOOL CD1::OnInitDialog()
{
CPropertySheet *PS1;
PS1 = new CPropertySheet("", this, 0) ;
CPropertyPage *pp1 = new PP1() ;
CPropertyPage *pp2 = new PP2() ;
PS1->AddPage(pp1) ;
PS2->AddPage(pp2) ;
PP1->Create(this, WS_CHILD | WS_VISIBLE) ;
PP1->ShowWindow(1) ;
}
PP1.cpp
void PP1::OnBtnOpen()
{
CString fileName ;
char charFilter[256] ;
char fileExt[100] ;
char *filename ;
strcpy(charFilter, "File Filter (.mmm)|*.mmm|") ;
strcpy(fileExt, "mwf") ;
CFileDialog fileDialog(TRUE, // Open File Dialog
fileExt, // default extension
NULL, // Initial File Name
OFN_HIDEREADONLY |
OFN_OVERWRITEPROMPT |
FILE_ATTRIBUTE_DIRECTORY,
charFilter, // File Filters
AfxGetMainWnd() ); // Parent Window
if( fileDialog.DoModal() == IDOK )
{
return ;
}
}
my application hangs at fileDialog.DoModal().
Please help me in rectifying it.
|
|
|
|
|
Sreenivasa.Murthy.G wrote:
strcpy(charFilter, "File Filter (.mmm)|*.mmm|") ;
filter always end by Double | operator i.e. ||.
this may be causing the problem.
right way to write charFilter is
strcpy(charFilter, "File Filter (.mmm)|*.mmm||") ;
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|