473,796 Members | 2,720 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HELP: drawing on winform from native Win32 paint crash app....

Hi,

I have an application written in C# which will use some custom libraries
written in native C++. To bridge between the C# application layer and the
native C++ library side, I created an IJW assembly using mixed mode C++/CLI
and native C++. From the C# application side, I need to pass a window handle
to the custom library so that inside this library, it will do some drawing
on this screen. So, I from the C# application passed a Control.Handle to the
library. However, the moment the custom library tries to draw something on
this screen(I used SPY++ to trace it), it will crash when WM_PAINT is
called. The error is

AccessViolation Exception: Attempted to read or write protected memory. This
is often an indication that other memory is corrupt.

Why does this happen? How do I solve it ?. I have even tried creating a
window on the IJW library using CreateWindow("S TATIC"...) and pass this to
the custom library for it to use but the problem still occurs. If this
window is hidden. the app will not crash. It will only crash the moment this
window is shown.

Anyone could help me on this? Thanks!!!!

John


Jul 19 '06 #1
0 1373

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4914
by: Serge Klokov | last post by:
Hi! 1. Please, help with example "paint on form by mouse" 2. Below is my example, but it clear the line after each Refresh()... how to fix? 3. How to draw the line in Mouse_Move event? private Boolean isCanPaint = false; private MouseEventArgs MouseEvent1;
4
4523
by: Peter Oliphant | last post by:
There doesn't seem to be any documentation on how to create and/or use an instance of System::Drawing::Graphics. On-line MSDN talks about this class, and says: " The Graphics class provides methods for drawing objects to the display device. A Graphics object is associated with a specific device context. " Great. So how about explaining HOW to do this? Or perhaps a code example? Or at least a CONSTRUCTOR (or some explanation on how to...
7
1659
by: Galen Somerville | last post by:
I'm doing something wrong. I made up a test app and put the ZIP file on my website http://home.surewest.net/galen/index.html under Downloads. Basically I have a Panel that will get continuous updates and I don't want any flicker. In the test app it sets up a mem map and sets it to Black. When the Button is clicked it calls a routine that puts tick marks at top and bottom. The tick marks do not show up.
3
1750
by: James | last post by:
I'm interested in learning C++. I'm not sure exactly what this means. I'm currently a VB.NET/C#.NET programmer (both Windows Forms and ASP.NET). I am totally clueless when it comes to C++. I've tried creating new projects and even that is confusing. I'm unsure of the differences between MFC, ATL, Win32, etc. etc. applications. I don't even know where to begin. If I wanted to write a full screen application with some type of simple...
0
1481
by: Marcus Kwok | last post by:
I have written a class (Windows Form) in Managed C++ that accepts an array of image filenames and will display them sequentially. All images will be the same size. I got it to work, but I know something is not right because of the way I am using Application::DoEvents() (ref: http://www.codinghorror.com/blog/archives/000159.html and http://www.codinghorror.com/blog/archives/000370.html ), along with the fact that I get a crash when I try...
2
11734
by: sambo251 | last post by:
After running a few updates I get this very annoying "Windows Installer" error #1706 that will ne go away! It keeps saying that it cannot find the file "instantsharedevices.msi", that it is on another CD, and gets caught in a loop when I try to delete it! It mentions MS.net frame error # 1706. The "details" code follows...hope someone can help me to either fix it or get out of the loop! I tried running "Windows Registry Repair Pro"...but no help...
0
2013
by: dadizhu | last post by:
Hi, everyone. I ran into an UI freeze issue with threading and simplied the problem down to the following sample code. The logic is as follows: 1. The main UI thread creates a non-UI STA thread(m_MainThread). 2. Then the non-UI thread runs and creates derived winform and holds a reference to the winform. NOTE: I don't call Application.Run() because I don't need a message pump on this "hidden form" in my application. I rely on the...
2
2982
by: Ringo | last post by:
Please excuse the long post, but I have an issue and don;t know how to describe it without describing the app. I have an app that reads data fro the serial port and draws it on the screen. I have a timer set up, and when the timer fires it either calls Simulate_read_sensor() or read_sensor() depending on a checkbox. The simulate function does this for (x = 0; x < 102; x ++) {
2
1310
by: =?Utf-8?B?Wmhlbnlh?= | last post by:
Hello, I am a C++ newbie. I developed a Win32 DLL that creates a number of threads, which can throw exceptions. When an exception is thrown on a thread in Win32 DLL, I want to catch that exception on the main thread. Is there any way to throw an exception on one thread and catch it on another thread? If #1 is not possible, is there a catch-all exception handler at the process
0
9673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9524
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10168
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9047
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5568
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.