|
Sounds like you're trying to dereference a NULL pointer, or possibly you've tried to GetProcAddress something and not checked it before calling the resulting function.
Steve S
|
|
|
|
|
another code offered the following suggestion, but did not follow up on it. Is anyone here able to expand on it? specifically "try with proper api declaration"
...
Perhaps, your converted application still have lots of api call, which is trying to access certain memory location, which is not allowed..
try with proper api declaration, or using the .net functions which replaces those apis...
...
Thank You
|
|
|
|
|
after further review....this debugger sure hasnt helped much....the error appears to be with using
lpfnGradientFill = (LPFNGradientFill)GetProcAddress(MSIMG32_DLL,"GradientFill");
I get a valid pointer, but using the function seems to cause the error. Will investigate further.
Thank You
|
|
|
|
|
Another cause might be a trashed stack. Thus the "ret" ends up going to 0.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
that seems to be the case. I can step through my function that uses the gradient fill, but at the return is where I get the error. We run our application through BoundsChecker and Insure when compiled with VS6 and it runs cleanly. Any way to determine what is causing the corruption?
Thank You.
|
|
|
|
|
turns out this was all from lazy programming.
when loading the gradient fill I declared as follows:
typedef BOOL (*LPFNGradientFill)(HDC,CONST PTRIVERTEX,DWORD,CONST PVOID,DWORD,DWORD);
which ignored the calling convention, needed to be:
typedef BOOL (WINAPI *LPFNGradientFill)(HDC,CONST PTRIVERTEX,DWORD,CONST PVOID,DWORD,DWORD);
Thank You
|
|
|
|
|
Hello!
I want to display buttons in a CToolBar each with either a string or a bitmap. The problem is now that SetBitmapSize() allocates space for the bitmaps even in the buttons that have no image at all. Therefore, they've got larger widths than desired. Someone told me I should use BTNS_SHOWTEXT and BTNS_AUTOSIZE. But Visual C++ 6.0 throws error C2065, because it does not know those constants.
Any suggestions to solve that problem?
Bye,
Ulrich Schmitt
|
|
|
|
|
You should get the latest Platform SDK and install it.
This will give you access to the latest headers and libs, although you have to exercise some caution if you want your apps to work on older (Win9x,NT) operating systems.
Steve S
|
|
|
|
|
I installed the new version. But if I rebuild the whole project I get a new error:
Fehler beim Start rc.exe<br />
Browse-Informationsdatei wird erstellt...<br />
BSCMAKE: error BK1506 : Datei '.\Debug\StdAfx.sbr' kann nicht geoeffnet werden: No such file or directory
This means that the file .\Debug\StdAfx.sbr couldn't be opened. Perhaps something with rc.exe is wrong? If I want to open it by double clicking its icon I get the information that this file is not a valid application for Windows. Other executables in the same directory can be started by me. But I did not try all because there are a lot. By the way it has 32.768 bytes and I work on Windows NT.
Bye,
Ulrich
|
|
|
|
|
The following will give you a hint as to where to start looking!
// ToolBarEx.h : header file
//
// From: MFC Knowlege base
// BUG: Resizing CToolbar with Dropdown Arrow Buttons Freezes Apps
// ID: Q190501
// From: Microsoft Systems Journal (Aug98CQA.zip)
// Problem: When using TBSTYLE_EX_DRAWDDARROWS and TBSTYLE_DROPDOWN
// the right end of the toolbar gets cut off or if it is a
// vertical toolbar the bottom gets cut off.
// Fix: CalcSize()
//
// From: John R. Shaw (Me)
// Problem: If you only fix CalcSize() the sizing calculations are
// still wrong because WrapToolBar() uses the same invalid
// width value used in CalcSize().
// Fix: WrapToolBar()
INTP
|
|
|
|
|
I think it is better and real problem of smart pointer,
to check what they own -
does it stack memory place pointer,
or allocated,
does it was deleted or not,
or must be deleted and not did - so must be asserted
at place of problem immedialtely. + (means plus)
It makes possible -
correctness of deleteing and
copy to incorrect places check,
check for leak finally -at shared pointes.
The most problem for poiners in program.
Does some pointer provides memory-check for operation correctness control ?
Other behavior- as shared_Ptr from boost
|
|
|
|
|
Your english needs work! But I think you want to know wether you need to delete a pointer or not. That is wether it has been push on the stack or allocated by you (or some body else). [If you do not know you already have a problem]
If you are the main person in charge of the project you could create your own overridenned version of new that would would insure that all allocation made with new.
INTP
|
|
|
|
|
I can develop it myself,
but I would check it against somebody already did this work.
So I asked.
English:
I try to write correct, but
If you do not understand please do not write,
due to I think that in cases when people is not
joy(!)
- thay easily can understand any foreign people.
With any of their errors.
as I understand foregn to me people.
|
|
|
|
|
Hi all,
I have an XML file and i want to append the data of another XML file to the previous file..I have tried using createNode() or CreateElement() but nothing seems to work..I dont know where i am doing wrong..Please help me out...Any help or pointers are highly appreciated..I need it urgently..Please..Thanks a lot in advance..
Regards,
Himanshu
|
|
|
|
|
This has got me stumped. I've got a program that draws a circle, triangle, or square depending on the item selected in a Shape menu (three sub-items: circle, triangle, square). I've got accelerators set, and they do in fact work, yet the appropriate menu sub-item letters are not underlined as they should be to let the user know that the key is an accelerator. For example the circle sub-item was defined as: &Circle\tF7
F7 and Alt C works, but the "C" in circle is not underlined. The "F7" does show up when the Shape menu is displayed. I'm using VC 2003 and this is the appropriate code in Resource.rc:
IDR_MAINFRAME ACCELERATORS
BEGIN
VK_F6, ID_NEXT_PANE, VIRTKEY, NOINVERT
VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT, NOINVERT
VK_F7, ID_SHAPE_CIRCLE, VIRTKEY, NOINVERT
VK_F9, ID_SHAPE_SQUARE, VIRTKEY, NOINVERT
VK_F8, ID_SHAPE_TRIANGLE, VIRTKEY, NOINVERT
"C", ID_SHAPE_CIRCLE, VIRTKEY, ALT, NOINVERT
"T", ID_SHAPE_TRIANGLE, VIRTKEY, ALT, NOINVERT
"S", ID_SHAPE_SQUARE, VIRTKEY, ALT, NOINVERT
END
/////////////////////////////////////
IDR_MAINFRAME MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "E&xit", ID_APP_EXIT
END
POPUP "Shape"
BEGIN
MENUITEM "&Circle\tF7", ID_SHAPE_CIRCLE
MENUITEM "&Triangle\tF8", ID_SHAPE_TRIANGLE
MENUITEM "&Square\tF9", ID_SHAPE_SQUARE
END
END
///////////////////
Again, the problem is that the "C", "T" and "S" in Circle, Triangle and Square are not showing up underlined when the program is run. ???
sf
|
|
|
|
|
Are you running XP or 98?
If you are using XP, the Accelerator keys are not underlined until you press the alt key.
To disable this feature:
From the control panel click on "Display"
Click on the "Appearance" Tab
Click on the [Effects...] button
Uncheck "Hide underlined letters for keyboard navigations until I press the Alt key"
|
|
|
|
|
Hi, CDC has method to floodFill, but if I want to do double buffer, I need to use Graphics object as offscreen device... but Graphics has no floodFill method... Any suggestions???
|
|
|
|
|
|
I want to code a sdi program without document-view support(changed slightly form program appwizard generates).There are two CFormView in it,a and b;I try hard to switch between them,not to destroy one and create another,just hide one and show the another.but it doesn't function as expected.
i use two create functions in CMainFrame:onCreate()
as if (!a.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
{
TRACE0("Failed to create view window\n");
return -1;
}
if (!b.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
{
TRACE0("Failed to create view window\n");
return -1;
}
in a menu command item;
i use a.ShowWindow(SW_HIDE) and b.ShowWindow(SW_SHOW|SW_MAXIMIZE) ,but it doesn't work
can anyone help me ?
|
|
|
|
|
Hey all, any time I want to use some code that I find in an article on codeproject (or one of its competitors), it's annoying going through the process of adding it to my project.
Here is what I'm proposing:
I (and anyone else who is interested) create some helper functions in the form of a macro (.dsm) that will allow developers who submit code to this site (and other sites) to very easily create an additional macro file that will allow users to automate the insertion of the code into their project.
Does anyone know if this has already been created? Do you think that this would be a useful project? Anyone want to join me in creating some functions?
|
|
|
|
|
Sounds scary as hell to me. The best way to introduce bugs quickly into your code used to be with a quick cut and paste, but even quicker would be to get a macro to do it.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Consider a simple file in Ms Word. Let's say the file has
First Name : Last Name :
I have a program in Visual C++ that gets the first and last
name of the individual. I can use ShellExecute to execute
the word file, but how can I make the first and last name
go into the file and appear where I want them to. I prompt
the user for the information in the Visual C++ program and
move that info to the word file....somehow???
Any ideas or any web pages that would kinda of explain this?
Please, any response anyone can give me will be greatly
appreciated.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
You'll need to use Automation to run Word and change the contents of the active document. There are tons of docs on doing this, start by looking at the Office development docs, or even the Word help (if you've installed the VBA help).
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber
Kosh reminded me of some of the prima-donna programmers I've worked with. Knew everything but when you asked them a question; never gave you a straight answer.
-- Michael P. Butler in the Lounge
|
|
|
|
|
If you need the changes to be static and 'in' the file, then stop reading.
The quickest way would to be to use an embedded property in your doc. Then just modify the doc property and when you open the doc presto.
For example in my doc i might have the link :
{DOCPROPERTY "Category" \* MERGEFORMAT}
In explorer if i right click on the file and look at Properties-Summary I can see, and set, the Category value. I'm sure i saw a project here somewhere a year or two ago about getting/setting file properties.
|
|
|
|
|
To make this short, we're using the latest Visual Studio (.NET 2003) on Windows XP, and memory allocations are incredibly slower (takes about 12 times as long) when the executable is launched from within the debugger as compared to launched from a command line.
Specifically, I've got an example program that demonstrates this up at http://www.horningabout.com/temp/SpeedTest/ , if you want to take a look. It's just doing a loop and repeatedly allocating and freeing memory. VTune reports all of the time is being spent in RtlCompareMemoryUlong and RtlFillMemoryUlong when launched from within the debugger, while these are never called when launched from the command line. I have determined that these calls are in no way required to debug, since I can launch the program from a command line, then attach with a debugger, and then have the program continue, and it will be fast, not calling these functions.
After talking back and forth with one of the engineers on the VS team at MS, I found out that when NT creates a new process and initializes the heap, it sets some flags saying to clear the memory before allocating and after freeing it, which is what is taking all of the time. The code below is a quick workaround for anyone else experiencing this problem (note that it depends on some internal structures of the heap that I have only verified on XP):
int WasLaunchedInNTDebugger(void) {
long *data;
int ret=0;
data = HeapAlloc(GetProcessHeap(), 0, 8);
if (*data == 0xbaadf00d) {
ret=1;
}
HeapFree(GetProcessHeap(), 0, data);
return ret;
}
void disableRtlHeapChecking(HANDLE heap) {
extern HANDLE _crtheap;
if (heap == NULL)
heap = _crtheap;
if (WasLaunchedInNTDebugger()) {
assert(*((long*)heap + 4) == 0x40000061 ||
*((long*)heap + 4) == 0x40000060);
*((long*)heap + 4) &= ~0x7D030F60;
}
}
I hope this helps someone, it was a pain to figure out and fix!
|
|
|
|
|