|
Run the debug build under the debugger, look at the call stack where the assert fired, and determine what the value of m_hWnd is. Typically it means that you're trying to use a pointer to a CWnd object that was temporary (such as if you stored the return value of GetEditControl - MFC cleans up these temporary CWnd objects during idle processing), a window that's been destroyed, or a window that was never created.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
hi everyone,
i am in a console project using Visual C++ 6 where main function should receive parameter from the command line.
when i debug the project, i would like to simulate that params passing...
is there a way to do that ?
in brief, i'd like the debugged program to act as if it had been passed its parameter as the following when i push the Build|Start Debug|Go menu command :
myprogram file1 file2
thanks all
TOXCCT >>> GEII power
|
|
|
|
|
Hi there
Yes, there is.
Go to Project | Settings... (Alt + F7) on the "Debug" tab, look for the "Program arguments" field, there you can put the arguments you want to pass.
Fabian
|
|
|
|
|
|
I now how to call api functions with visual basic
I’m new with C++ ,
I cant find out how to call this function with C++
<code>
file name : APIDeclarations.bas
' Declare API calls for System access
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
How do I declare this function ?
</code>
This is the function, thats not the problem
<code>
Option Explicit
Public Sub WSHWait(ticks As Variant)
' For WSH: provide a Wait-Function
' ticks: delay time in milli seconds (must be > 0)
Dim ticks1
On Error GoTo Error
If Not IsNumeric(ticks) Then
MsgBox ticks & " illegal value for parameter ticks", vbOKOnly, _
"DaemonExt Error in method WSHWait"
Exit Sub
Else
If ticks < 0 Then ' catch negative values -> infinite wait
MsgBox ticks & " illegal value for parameter ticks", vbOKOnly, _
"DaemonExt Error in method WSHWait"
Exit Sub
End If
End If
ticks1 = ticks
Sleep (ticks) ' Wait x milli seconds
Exit Sub
Error: ' Error handling
MsgBox "Run-Time Error number " & Err.Number, vbOKOnly, _
"DaemonExt Error in method WSHWait"
End Sub
Sub Wait(x)
' provide a Wait-Function
Dim start, i
start = CInt(Second(Time))
i = 0
Do
i = i + 1
Loop While (CInt(Second(Time)) < start + CInt(x))
End Sub
</code>
Nice code, doesn't use any CPU time during wait
Greets Jeroen
|
|
|
|
|
each library indexed function has its synopsis into .h files.
to include these files, do #include <the_file_to_include.h> at the top of the file.
hum well, now tell me, you ask for C++ code, but do you think the code you wrote was C++ ?
a definitely don't think so.
anyway, you can also have a look at the MSDN for any C/C++ functions you want details about.
cheers
TOXCCT >>> GEII power
|
|
|
|
|
No its visual basic code,
I only need to now how i Declare api calls for system access
like this with visual basic code :
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Do i need a lot of code ?, for this function call ?
I dont want to use the command Sleep (3 * 1000);
its using a lot cpu time
Thanx for help
Greets Jeroen
|
|
|
|
|
Hi there,
No you do not need a lot of code, just be sure you have the right header included.
For Sleep, you need this line
#include <winbase.h>
but it could be already included, Windows.h includes Winbase.h, so you may not have to include any extra header.
Regards,
Fabian
|
|
|
|
|
even if header files are already by other headers, it worth it to include it again because it can make your code clearer.
that is beacause header are proteected by proprocessor directives such as #ifdef #ifndef #if !defined #pragma once ... and so on.
TOXCCT >>> GEII power
|
|
|
|
|
How can I do a findfile beyond MAX_PATH ?
|
|
|
|
|
MSDN:
pFileName:
[...]
Windows NT/2000: In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to nearly 32,000 wide characters, call the Unicode version of the function and prepend "\\?\" to the path. For more information, see File Name Conventions.
Flirt harder, I'm a Coder
mlog || Agile Programming | doxygen
|
|
|
|
|
Yes if you know the filename that is good but otherwise you need to "find the file" ? Or is there a possibility to read a directory in some other way?
The find structure is insufficient ?
typedef struct _WIN32_FIND_DATAW {
...
WCHAR cFileName[ MAX_PATH ];
WCHAR cAlternateFileName[ 14 ];
...
} WIN32_FIND_DATAW, *PWIN32_FIND_DATAW, *LPWIN32_FIND_DATAW;
FindNextFile()
|
|
|
|
|
You can pass a long path like that as base path to the FindFirstFile function (the doc snippet was taken from there). the "cFileName" contains only the name of the found file/folder (not the full path).
Flirt harder, I'm a Coder
mlog || Agile Programming | doxygen
|
|
|
|
|
Hi all;
I am building an SDI application with a a web-browser control in a view (my project has a single view). The problem is that i need to load web pages into the web-browser control by clicking buttons found here and there in the dialogs of my application. Actually, i cannot access the web-browser control since it is solely in the view. Can somebody please help me in finding a way to make to the Web-browser control available (apart from making it global. I have some linker problems when i do this.)
Please help me out.
Thanx
Build tomorrow today cos' tomorrow will be too late...
Krugger
|
|
|
|
|
Here's one way to do it:- Make the web browser control a public member (eg:
m_webBrowserCtrl ) of your view class (eg: CMyView ).
- Access the web browser control from anywhere in your application by referencing
((CMyView *) ((CMainFrame *) AfxGetMainWnd())->GetActiveView())->m_webBrowserCtrl . /ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi;
I am buidling an SDI application with a CDialogBar whcih behaves pretty much like a modeless dialog (in fact, it is). The problem that i am having is that there are a few list controls on the DialogBar and i need to edit some items in it after the DialogBar has been created. To access these controls, i need a valid handle to the DialogBar. Can anybody please help me with some good answers for this. Could you possibly help me out on how to use the handle to edit the list controls once i have got it please?
I badly need this.
Thank you very much;
Build tomorrow today cos' tomorrow will be too late...
krugger
|
|
|
|
|
Here's one way to do it:
- Make the dialog bar a public member (eg:
m_myDialogBar ) of your CMainFrame class.
- Access the dialog from anywhere in your application by referencing
((CMainFrame *) AfxGetMainWnd())->m_myDialogBar . /ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Is there a way to get a windows HWND by way of the windows title, *if* you only know part of the title?
Example... How can I get the HWND of internet explorer? I know the window title (normally) contains "Microsoft Internet Explorer". Look up at your title bar now, you'll see the web page title then "- Microsoft Internet Explorer". So, can I get the HWND with just "Internet Explorer"?
::FindWindow(NULL, "Internet Explorer"); <--- Don't work.
Hope I explained my problem well enough!
Thanks!
Daniel
|
|
|
|
|
a) FindWindow is evil on so many levels. Forget it
b) try to find well-defined application-specific ways to find windows first. The Shell interfaces might contain something for explorer.
c) Use EnumWindows to enumerate all windows. Ask their properties using SendMessageTimeout
d) Never link your expectations about a window to the title. You think a Chinese Explorer has "Windows Explorer" there?
Flirt harder, I'm a Coder
mlog || Agile Programming | doxygen
|
|
|
|
|
peterchen wrote:
You think a Chinese Explorer has "Windows Explorer" there?
I got see what it is ?
God is Real, unless declared Integer.
|
|
|
|
|
|
What is that written in red ? "Folder"???
God is Real, unless declared Integer.
|
|
|
|
|
The red words should read as "To open that folder (swf)".
The image was found with Google, it is one of illustrations for some operation manual.
That is Windows Explorer of Windows 98, on the title bar there is "Windows Explorer" in Chinese.
I've had a look with my Windows Explorer of WinXP just now. It doesn't show something like "Windows Explorer - Temp" in the current version. Only "Temp" is shown while current folder opened is C:\Temp for example.
Maxwell Chen
|
|
|
|
|
I have developed namespace extension for my company, all these little difference in feature between winxp and win98 caused lot of design problems.
God is Real, unless declared Integer.
|
|
|
|
|
is there an operator to make a left circular shift directly ???
thanx
shakoosh
|
|
|
|