|
Hi,
I have strange problem with my dialog based app.
I use modified PropertySheet/PropertyPages on main dialog
Base is StackDialog by Zoran M.Todorovic, found on codeguru or maybe on codeproject.
In some moment i realized that when I close application, no one get focus.
Alt+Tab combination don't work. Alt+Esc stil can to open start meny, and after that Alt+Tab work well.
Main dialog have added menu, tooltips...
I try to set focus to the previous application in ExitInstance
Question is
1. How to repair application to exit properly
2. How to find which app is behind my app, (in z-order)
e.g. how to force regular exit
thanks for every suggestion
|
|
|
|
|
Im trying to undefine a setting from a function one file
that calls another file where the actual #define is used.
the problem is much the same as this code.
I know you can fix this by putting the volume code
below main() but is their any way around this other than
moving the code ?
<br />
#define VOLUME_UNITS 1<br />
<br />
int volume ()<br />
{<br />
#ifdef VOLUME_UNITS<br />
return 10;<br />
#else<br />
return 20;<br />
#endif<br />
}<br />
<br />
int main(int argc, char* argv[])<br />
{<br />
int vol;<br />
#ifdef VOLUME_UNITS<br />
#undef VOLUME_UNITS<br />
vol = volume ();<br />
#define VOLUME_UNITS <br />
#else<br />
vol = volume ();<br />
#endif <br />
<br />
printf ("%d\n", vol);<br />
<br />
#ifdef VOLUME_UNITS<br />
vol = volume ();<br />
#endif <br />
<br />
return 1;<br />
}<br />
|
|
|
|
|
Little bit confused as to what you are trying to do, but just looking at the code, the #ifdef and #undef's in the main funtion don't really serve any purpose. Any #directive is dealt with by the compiler, not the linker or at runtime. I'm guessing by the bit of code that goes (code is paraphrased!):
#ifdef VOLUME_UNITS
#undef VOLUME_UNIT
vol = volume()
#define VOLUME_UNITS
...
#endif
... you are trying to turn off the VOLUME_UNITS for that particular execution of volume(), won't work - the evaluation of VOLUME_UNITS will only occur when compiled, not when volume() is executed. In effect, the code above is equivalent to:
main ()
{
int vol;
vol = volume ();
:
#ifdef VOLUME_UNITS
vol = volume ();
#endif
}
If you want something evaluated runtime then the only thing is to do it runtime (extra argument, an 'if' statement etc)! Alternatively, I may have misunderstood your question...
|
|
|
|
|
What segment of the SDK needs to be updated to get the gdi+ lib, dll and header files?
I need to know this as i wont have enough hd space for the full SDK platform upgrade. (Note I am assuming GDI+ is in one of the platform upgrades)
|
|
|
|
|
Is this a wise thing? I have a heap of little tables that would never have more than 100 or so entries so did not want to use a database like Access or MSDE.
I was thinking of using XML to store the data and DOM to access it, I basically need to be able to add/modify/delete records and do some simple queries, e.g. "give me all records where this element equals this value", this should all be possible using DOM?
|
|
|
|
|
yes, this is possible, but you won't be able to use automated queries, stored procedures... having less work in order to connect to the database (because there is not a database at all), but having more work in order to make it give you the right results because you'll need to make all the normal database stuff for yourself...
Hope this helps...
|
|
|
|
|
For years now we have all been working with two software configs
Debug and Release (cross product with other things like Unicode,
or various languges etc.)
I have been thinking about adding an additional type of config
to my projects, and wanted your opinions. Debug, of course, is
overloaded with extra debugging checks, ASSERTS, ASSERT_VALID
and so forth. Consequently, it is loaded down with extra stuff
that makes it run slow. (Also the optimizer is generally off
to make single stepping code easier.) Release turns off all that
stuff to maximize the speed of the program (which, BTW, usually
means mimizing the size of the program rather than the number of
instructions on modern CPUs, but that is a different issue.)
I have been considering an intermediate type of configuration,
call it Rebug a combination of Release and Debug. This tool
keeps all the ASSERTS and other debugging tools, but redefines
them to log as errors, and dump minidumps as opposed to breakpoints.
Similar with unhandled exceptions etc. Rebug is also stripped
of symbols (though I keep a pdb.)
What is the purpose of Rebug? Well it is released as part of
the install, and installed right next to the release version.
If a bug happens in the field, the user can switch to the
Rebug version (presumably through a menu command in the Release
version), recreate the bug, and generate all sorts of tracking
information for the debugger back at home base. In particular
it catches problems early, by detecting failed assertions,
uncaught exceptions, and so forth. Rebug would also include
various options like range checking, stack frame checking,
dog tags and so forth. It would allow the generation of
a good debug run in the field for debugging without sending
out the debug version, and having a breakpoint fire in the
middle of a real user session.
Why not just use the standard XP mechanism for handling crashes?
Because the Rebug version can potentially catch the problem
early enough that it is readily apparent what is happening,
rather than looking at a static picture where the data set is
already screwed up.
I wonder what y'all think of this idea?
|
|
|
|
|
We have been using this sort of setup for a few years now, and it is very usefull indeed. In fact, we usually have more than just debug,release and the one you call "rebug". We also have Debug Optimised, ( "Derel" ? ), which is the full debug-build with optimisation turned on. When you have something which only crashes in release, it can be good to go backwards towards the normal debug build through these two extra targets.
The only problem with the scheme is that multiple configurations like these are poorly supported by VC...well, at least VC 6. It's a hassle to maintain and there are bugs which will mess up your configurations when you alter options in the menus. The configuration manager in VC 7 seems better.
-=jarl=-
|
|
|
|
|
DOS prompt
i use VC++ 6.0, what header can i include and what command can i use to copy the contents of a DOS screen to a file, like if i wanted to copy the directory of a folder to a file.
EMAIL
i made a program that displays info and i just copy and paste it to an email, is there anything i can do to just directly send the info to the email? i doubt it's possible, i want to send it to NETSCAPE COMPOSER, thanks
|
|
|
|
|
It's very simple. In DOS world, try this:
c:\> dir *.* > myfile.txt
In this manner, all of reports from dir command will be redirect to myfile.txt
you can use ShellExecute or ShellExecuteEx API to do that for you. Remember that "*.* > myfile.txt" is argument of dir command.
A. Riazi
|
|
|
|
|
in order to access the menu items in an MDI app would you call getMenu() on the child frame or the parent frame?
Ben
Oh wow
|
|
|
|
|
How can i associate a file type with my application.
|
|
|
|
|
Depends on OS. For NT5+ you can use the commands assoc and ftype at the command prompt.
If you're willing to do it manually, use Regedit.
|
|
|
|
|
Please let me know path of the registry key or where i can find the information
|
|
|
|
|
How can i convert char into hex and print on text box.
|
|
|
|
|
|
char MyChar='a';
m_MyTextBox.Format("0x%x", MyChar);
UpdateDate(FALSE);
In this case, m_MyTextbox is your member varible with variable type CString to attached to TextBox.
A. Riazi
|
|
|
|
|
Hiya I have only started to learn SQL in MFC/C++. I have a program that opens a ACCESS DATABASE and I can do queries on it no problem using SQL - using CDatabase and CRecordset. My question is how is a SQL server accessed??
Is it the same as I have accessed the ACCESS DATABASE?? Normally on a SQL server, are the files all kept as databases and that is how you can access them the same??
Can anyone give me some info on accessing a database on a SQL server..
Thank you.
grahamoj.
|
|
|
|
|
Basically, the answer is yes, it is the same. In days gone by
(Visual C++ 6.0) a separate set of classes were used for access
called DAO classes, specifically CDaoDatabase and CDaoRecordset,
however those are no longer "supported" in Visual C++ .Net.
However, Access is an ODBC source, which is what CDatabase and
CRecordset use. Consequently, Access works with these classes.
SQL Server (and MSDE) also are ODBC sources. To access them you
need to do one of two things: either use the wizard to generate
the classes and select the SQL DSN as the data source, or
alternatively open the database with the appropriate DSN for
the SQL Server database.
HTH.
|
|
|
|
|
hi,
i'm having problem getting odbc to retrieve paragraph of text from a ms access.. whenever, odbc attempts to read the paragraph text, it alwasy crash.. however, i have no problem storing the paragraph text into the database.. anyone know any solutions?
thanx in advance!
|
|
|
|
|
Have you the Exception handling built in and working? ->Message leads to error.
Is there a supplied buffer for text and the data type right, there a some tricky things in this way
Try this @ home. (B&B)
|
|
|
|
|
When I try search-and-replace text in certain C files with Visual Studio.NET, I get a message box with a red X, the title "Microsoft Development Environment" and the message "Catastrophic failure". The development environment DOES NOT crash and if I repeat the search-and-replace, it seems to work.
Is anyone else seeing this? Any idea what's causing it or how to avoid it? I get no hits on the Knowledge base when I search the knowledge base on "Catastrophic failure visual studio".
Also, I can't find anywhere in the Visual Studio Help or on MSDN about submitting a bug report (searching for "Bug report" "Visual studio" on MSDN returns no relevant hits) and there is nothing about submitting bug reports on the "Visual Studio," "Customer Support," or "Contact Microsoft" pages at MSDN. If anyone from Microsoft is reading this, are you interested in bug reports and if so, how does someone find out where to submit them?
|
|
|
|
|
I am not real clear on using structure statements and external function calls. I am getting the following errors when I compile the file below. Can someone hlep? Thanks.
cinterface3.cpp(22) : error C2228: left of '.start' must have class/struct/union type
cinterface3.cpp(24) : error C2664: 'CreateThread' : cannot convert parameter 3 from 'void (long *)' to 'unsigned long (__stdcall *)(void *)'
cinterface3.cpp(30) : error C2228: left of '.time' must have class/struct/union type
#include <stdio.h>
#include <string.h>
#include <windows.h>
struct io {
char time[10];
int start;
};
struct io cio;
extern "C" __declspec(dllimport) void _stdcall FTREND3
( long * );
void main (void)
{
DWORD tid, cio;
HANDLE hThread;
cio.start = 1;
hThread = CreateThread(NULL, 0, FTREND3, &cio, 0, &tid);
CloseHandle(hThread);
printf("In c after fortran thread started\n\n");
printf("string = %s\n",cio.time);
}
|
|
|
|
|
Two errors here:cio is a DWORD , seems like you meant it to be a io :
DWORD tid;
io cio; FTREND3 does not have the interface expected by CreateThread , as it accepts a long * where CreateThread wants a void * . In this particular case, you can simply force the cast:
hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)FTREND3, &cio, 0, &tid);
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|