|
I need to know how a program was started; by clicking an image or from a command line. How do I get this information? The starting point of this program is main().
-Janetta
|
|
|
|
|
You need to know who is the parend process (cmd.exe or explorer.exe),
look for undocument function ntQueryInformationProcess in ntdll.dll
|
|
|
|
|
My app crash on SetClipboardViewer in release mode but not in debug mode,
i call to SetClipboardViewer in OnInitDialog().
any ideas?? thanx
|
|
|
|
|
I have some troubles with MFC DLLs that contain resources.
First of all, I would like to know which MFC DLL project I have to choose exactly (Regular DLL or MFC extension DLL). And what about their differences ?
My problem is : when I have a resource (for example a Dialog) in my DLL which has the same Res ID that an another resource in my EXE, and when I want to show one of the two, I may have the other being displayed (because of the same ID). So currently I must compare the 2 "resources.h" to not have similar IDs which is not a great solution to my problem.
Please help me !
jpeg
|
|
|
|
|
I've got a MDI MFC app (without doc/view), with a CChildFrame and CChildView. I use SetWindowText to set the MDI child's title's, which works fine until I open a second MDI child, which then has its title set (correctly), but the first title is blanked out. If I toggle between the two of them they (the window titles) both disappear.
Whilst trying to figure out what I screwed up I used SetWindowText in CChildFrame::OnSetFocus and I can see the title being set but it then disappears straight away. Does anyone know what I've done wrong, or what I need to handle to get my MDI children to keep their titles?
Dylan Kenneally
London, UK
|
|
|
|
|
Dylan, you need to override CChildFrame::OnUpdateFrameTitle() and do your own thing there without calling the base class OnUpdateFrameTitle(). This is what I do in ED (see sig). I also use my own CMainFrame::OnUpdateFrameTitle().
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
Before, this worked fine:
CString programFilespec(__argv[0]);
Now (I think it's because I'm doing my app with Unicode support), it's crashing and telling me to send an error report to MS (I have XP).
Any ideas on what I'm doing wrong? I still don't know too much about Unicodifying apps. Thanks.
- Jason
(SonorkID 100.611)
In the beginning, teachers taught the 5 W's: who, what, where, when, why. Now it's just a big damn G
|
|
|
|
|
Use GetCommandLine to get the Command line and then parse it.
|
|
|
|
|
Where is the crash?
While I would expect that to still work (CString has constructors for both ANSI and unicode strings), try it with __targv instead which'll expand to __argv or __wargv as appropriate.
--Mike--
Just released - RightClick-Encrypt v1.3 - Adds fast & easy file encryption to Explorer
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Hi,
Wherte can i set the "Add/GR (Enable RTTI) compiler option" in order
to get correctly compiler?
Thanks in advance!
chen
|
|
|
|
|
Oh good, an easy one for my first ever post
Or at least, it's easy if you're using Visual Studio 6.
Project Settings -> C/C++ tab -> Category: C++ Language -> Enable Run-Time Type Information (RTTI) check box
Hope that helps (and is correct!). I'll be a tad if it isn't!
"We are the knights who say Ni" (The Knights Who Say Ni)
|
|
|
|
|
For MSVS this should be Project->Setting->C/C++ tab->General
there is a Project Options editbox, fill the switch there
or
instead of General, choose C/C++ Language, and there chceck the Enable Run-time.... checkbox
hope this helps
|
|
|
|
|
Thanks to Mike and CaesarCZ!
It worked!
Best Regards,
chen
|
|
|
|
|
Hi,
I'm writing an mdi-app with 2 doc-templates, that can be created in the file-menu via create doc a and create doc b. Doc a always works fine.
If I run the debug-build it works fine. The release-build, crashes if I want to create doc b. I switched on debug-symbols in the release-build and found out that the OnNewDocument method of my CDocb class never gets called (insead the one of CDocument).
However if I'm using Multithreaded debug DLLs in the release-build it also works fine. I've completely chunked up my code and now if I'm creating a doc b in debug-build I get a plain CDocument and in the release-build it still crashes. I don't know what I'm doing wrong.
(WinXP pro. VC6 SP5)
tia
|
|
|
|
|
i don't want a window to be resized. i want it to be fixed but i am not getting the way to do this stuff. is there anyone who can guide me
|
|
|
|
|
The easiest way is not to use the WS_THICKFRAME style when creating the window.
In the dialog resource editor, it's a property of the dialog box (in the styles tab, select the 'Border' dropdown and choose 'Thin'). In code, you can either remove the WS_THICKFRAME style in the call to CreateWindow (but note that WS_THICKFRAME is included in WS_OVERLAPPEDWINDOW) or, in MFC, you can override PreCreateWindow and modify the style there:
cs.style &= ~WS_THICKFRAME;
If you want a non-resizeable window but you want to keep the thick frame, you'll have to do something slightly more complicated involving WM_NCHITTEST.
"We are the knights who say Ni" (The Knights Who Say Ni)
|
|
|
|
|
There are a few ways that jump to my mind.
You could override OnGetMinMaxInfo / WM_GETMINMAXINFO to restrict the resizability of your window.
Change the window style (in PreCreateWindow) so you don't have a border to resize.
Override OnNcHitTest / WM_NCHITTEST so it returns HTCAPTION instead on HTTOP etc so you could move your window by dragging on the border rather than resizing it.
A word of warning though. In general, I like being able to resize things, and I'm not alone. Don't break the windows paradigm unless you have a _really_ good reason.
Good luck,
Iain.
|
|
|
|
|
my coworker uses stuff like this all over the code
vector<int> test;
vector<int>::iterator i;
for (i = test.begin() + 10; i < test.end(); ++i)
{
....
}
i = test.begin();
if ( test.begin() + 10 < test.end())
i += 10;
he asked me something bout this.. and i told him that this is not the proper way to do this (i think of having read that you never never never should another comparison than != for the end() function of a vector).. but actually i don't know any other way to skip 10 elements with one command..
is this proper code ?
what would be a safer way ? (if it isn't proper code ?)
thanks in advance,
bernhard
"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
|
|
|
|
|
U can very easily run an int counter, and check if in th loop ur not exceding the test.size() + or - offset value in order to take the values, and in order to take the element at the integer i, u can do test.at(i)
Papa
Murex Co.
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Yes, you should use !=, but you can quite happily use the +, so I see no reason why you can't just replace < with != above. < will work for vector, in any case.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
(This is rather academic, but anyway) The expression is not valid, even if you use pointers: pointers are only allowed to point one position past the end of a memory block_
char *p=new char[100];
char *p2=p[100];
char *p3=p2+1; Of course, the line above will work in any compiler that I know of, but the standard does not guarantee it. As for iterators, the situation is the same.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
You're right this is not safe. If you still want to write the stuff in one line, you can use std::distance
i = test.begin();
if ( std::distance(test.begin(),test.end())<10)
i += 10;
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Does anyone know if it is possible to write permission bits to an Access Database and if possible how to go about it. I want to set up a user logon system where they get different permissions and menu options depending on what group they belong to.
|
|
|
|
|
I've written a program in VC++ and when I run it my PC loses time!
Its a 'data recording' type program, reading data in through the serial port once a second, displaying the data on screen and storing the data to harddisk.
I thought maybe the clock would put its self right when I re-booted, but it doesn't. Surely the time is generated from an RTC (Real Time Clock) chip on the motherboard, how can I be affecting that ??????? I'm using 'GetCurrentTime' to read the time.
Any ideas?
Ali
|
|
|
|
|
Hi Alison!
Please explain me what is meant with 'loosing time' (how much?? in which amount of time...???)
It's not normal, my app is using lot's of timer-stuff (CTime objects with GetCurrentTime...)
Olli
cause sometimes the world is as strange as me....
|
|
|
|