|
Just trying to create a bitmap, but I'm getting some weird error:
Here's the code:
void GraphicsWindowsForm::PaintHandler(Object* sender, PaintEventArgs* e)
{
...
...
System::Drawing::Rectangle rcRect = get_ClientRectangle();
rcRect.Inflate(-10,-10);
//ERROR HERE! C3364!
System::Drawing::Bitmap* bmp =
new System::Drawing::Bitmap( (int) rcRect.Width, (int) rcRect.Height, (Graphics*) e->get_Graphics() );
Graphics* bmpGr = Graphics::FromImage(bmp);
bmpGr->FillRectangle(
new SolidBrush(System::Drawing::Color::White),
get_ClientRectangle()
);
... more code ...
...
}
Here's the error:
c:\Documents and Settings\Norman\My Documents\Visual Studio Projects\GDIplusApp\GDIplusApp.cpp(53): error C3364: 'System::EventHandler' : invalid second argument for delegate constructor; needs to be a pointer to a member function
Thanks!
norm
|
|
|
|
|
I've been programming on the Macintosh for many many years, and now I would like to write some Windows applications. I don't know where to start, though I do have a Windows laptop and Visual C++ .NET.
I'm interested in doing graphics and image processing applications, so I'd like to be able to read, write and process images of various sorts, use dialogs and menus, and respond to clicking and dragging in the content portion of windows.
Where can I find a sample application for these kinds of tasks?
Ken Turkowski
Engineer/Scientist
Independent Consultant Industrial Grade Software
Computer Graphics 2D 3D Immersive Imagery
Photo-mosaicing Panoramas Computer Vision
Applied Mathematics Numerical Analysis Optimization
|
|
|
|
|
DirectShow which is a part of DirectX might be what you're after. It offers the ability to write 'transform filters' to operate on a media sample, which might be video / audio or something else. The learning overhead for DirectShow is quite high (in my opinion, but I'm only a university student ).
It helps if you already have a good grasp of COM, and are prepared to sift through a fair bit of documentation, a muddle of macros (at times) and the sample applications which come with the DirectX API, available from Microsoft. The sample apps are probably the only viable place to start, you might find that you don't need to change too much code to get you running quite quickly. The samples are installed to C:\DXSDK\Samples\C++\DirectShow on my machine after a default install.
DirectShow includes GraphEdit a tool for combining transform filters into 'filter graphs' (source -> filter -> renderer pipelines). If you want to get going fast, copy and paste (changing the GUID's of course) from one of the sample filters, modifying the transform method and look at the output in GraphEdit. You can get the dialogs end of the application running (to a certain extent) by using property sheets. I found one of the best sources on how to set up custom property sheets that can be called from GraphEdit was in the OpenCV (Open Computer Vision) library (available on Source Forge) which contains a 'CamShift' DirectShow image processing filter, amongst heaps of other cool stuff.
Getting up and running in your own application can be a bit more challenging, one place to start is with the SampleGrabber filter and/or the playcap capture sample. The benefit of going this way allows you all the flexibility of choosing your windowing library (WTL, MFC or raw Win32) for all the really complex GUI stuff.
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
Hello all
I would like to retrieve LOCAL AREA NETWORK's ipaddress range(starting to ending address) programmatically. Is there any way to do it. Currently I'm using vc++(MFC) to code my application. if you know how to do it, please help me.
Many thanks for your help.
Hari.
|
|
|
|
|
take ip address of your machine, mask it with the subnet mask and you'll have the address of the subnet, then you can set all masked-out bits to 1 and you'll get the broadcast address for the subnet. Everything between is addresses that can be used inside the same subnet where the computer is located.
But this works only for one subnet, I don't know any universal method to get all addresses in the LAN if it consists of several subnets (except obvious 'contact your administrator')
Simplistic example:
IP addr: 192.168.0.1
MASK: 255.255.255.0
subnet addr: 192.168.0.0
broadcast.: 192.168.0.255
addr. 192.168.0.1 - 192.168.0.254 are available for use in this net segment
|
|
|
|
|
I just created an MFC class that will be useful for most of my applications. There are two files: Passport.cpp and Passport.h. Where can I place these files so that they an be automatically loaded by different ptojects.
The main problem is with the CPP source file. I have a folder for my H header files. I guess there should be a folder for the CPP source file too. While I can include the header file in the project, how is the associated CPP file loaded automatically?
Isaac Inyang
Ansyl Technologies
|
|
|
|
|
Hi
Add the cpp-file (or both h and cpp) to your project.
Regards
Frank
|
|
|
|
|
If you plan not to change the cpp file then you can compile it and create a lib file out of it. After that, if you have a location where you place your header files, you need to include it in the options by doing the following:
1. Click on Tools->Options
2. Click on the tab Directories
3. Where it says "Show directories for:" select Include files.
4. Click on the first button (it has a square) that is next to the field Directories: (or just double click on the field).
5. Add the headers' file location.
The same thing can be done for the lib files. You also have to add the lib file in the linker's options.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Hello ,
Iam in search of a vc++/WIn API code or interface which gets the list of pluggins installed for IE in the system
Cause is my effort;
Effect is God's effort
|
|
|
|
|
Hi. How do you access an xml file in C++, as well as write it and read from it.
"To teach is to learn twice"
|
|
|
|
|
|
I've programed a Hello world Dialog based app using MFC.I just a button and add MessageBox("Hello!") code,and I use Rational Purify to find the memory leaks,I always find a lot.
Why?
Thank you!
Let's roll!
|
|
|
|
|
Not every leak Purify/BC detects is the true leak.
Some like: "NoTrack" ( or "NoMemoryTrack"!? ) and SetEnv, delayLoad has to do with MFC structure, others leaks inside CryptoApis, etc has to do with crappy MS coding.
|
|
|
|
|
In addition to what Brian said, some leaks are due to improper termination. Many termination leaks are due to how the leak detecting program monitors the DLL. In some cases, they do not, or cannot, check memory in the proper spot. Regardless, these are of no real concern.
I haven't used Purify, but they should have a filter file for each compiler and library used. Be aware that on a few occasions these programs will do a false detection. I have perfectly legitimate code that totally "stumps" BoundsChecker as well as other programs.
The leaks to be concerned about are those that happen while the program is running.
|
|
|
|
|
Any clues on how to trap the standard Window | Close All command? I need to close a number of modeless dialogs before continuing with the standard operation, which closes all open views.
I suppose I could just define my own IDC_WINDOW_CLOSE_ALL command, but it seems like it's a pain to inject this menu item into the standard Windows popup.
Thanks,
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Well in ED I change the ID and do my own thing, but CWinApp::CloseAllDocuments(), CDocTemplate::CloseAllDocuments() might be of help.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Hi Neville,
Yes, that's my fallback solution. Do you know how to insert a custom menu item into the standard Windows popup (i.e. the one that contains an MFC generated list of view names)?
Thanks,
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi Ravi,
Have a look at CMDIFrameWnd::GetWindowMenuPopup(HMENU hMenuBar).
Assuming you are using a Menu Resource why can't you just change it there.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Yikes, I must be getting senile! Just looked at my code and found I already have a handler for a custom ID_WINDOW_CLOSE_ALL menu item in all my view classes. I copied the handler (and the menu) to the mainframe. and added the code to close all open modeless dialogs, so all is well.
Thanks for your help!
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I compiled reseditor using csc.exe. No problem. I even saved a test resource file with ".resources" extension successfully. It broke down unfortunately however when I tried to saved it as ".resx" format. Is there any place where I can download resource editor binary? I searched tucows, download.com, morpehus, microsoft msdn and google, no luck yet.
anyway, here's the problem, in case you wish to know:
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Resources.ResXResourceWriter.Generate()
at System.Resources.ResXResourceWriter.Dispose(Boolean disposing)
at System.Resources.ResXResourceWriter.Dispose()
at System.Resources.ResXResourceWriter.Close()
at ResEditorComponents.ResEditor.WriteResXFile(String fileName) in C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Samples\Tutorials\resourcesandlocalization\reseditor\ResEditor.cs:line 519
at ResEditorComponents.ResEditor.SaveResources() in C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Samples\Tutorials\resourcesandlocalization\reseditor\ResEditor.cs:line 485
at ResEditorComponents.ResEditor.menuFileSave_Click(Object sender, EventArgs e) in C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Samples\Tutorials\resourcesandlocalization\reseditor\ResEditor.cs:line 469
at System.Windows.Forms.MenuItem.OnClick(EventArgs e)
at System.Windows.Forms.MenuItemData.Execute()
at System.Windows.Forms.Command.Invoke()
at System.Windows.Forms.Control.WmCommand(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.0
CodeBase: file:///c:/windows/microsoft.net/framework/v1.0.3705/mscorlib.dll
----------------------------------------
ResEditor
Assembly Version: 0.0.0.0
Win32 Version: 0.0.0.0
CodeBase: file:///C:/Program%20Files/Microsoft%20Visual%20Studio%20.NET/FrameworkSDK/Samples/Tutorials/resourcesandlocalization/reseditor/ResEditor.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.0
CodeBase: file:///c:/windows/assembly/gac/system.windows.forms/1.0.3300.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.0
CodeBase: file:///c:/windows/assembly/gac/system/1.0.3300.0__b77a5c561934e089/system.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.0
CodeBase: file:///c:/windows/assembly/gac/system.drawing/1.0.3300.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
System.Xml
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.0
CodeBase: file:///c:/windows/assembly/gac/system.xml/1.0.3300.0__b77a5c561934e089/system.xml.dll
----------------------------------------
************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitdebugging="true">
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.
norm
|
|
|
|
|
Any one can help me how to change my desktop wallpaper and add a desktop items to active desktop( Icon, web,...) ?
----------------------
Coding for lv,lv & di
|
|
|
|
|
hi.
you can look this example.
http://www.codeproject.com/tools/wallpaperq.asp?target=change%7Cdesktop%7Cwallpaper
good work!!;)
|
|
|
|
|
|
Hi, all
I have created a RichEdit box (version 1.0) using regular windows API (no MFC) but I can’t seem to format (using the SendMessage() function) any part of the text in the control. I have tested both formatting the paragraphs (PARAMFORMAT structure) and characters (CHARFORMAT structure) but nothing seems to get displayed. The return values (from both EM_SETPARAFORMAT and EM_SETCHARFORMAT flags) are nonzero, which indicates success. I know that I am setting the cbSize and the dwMask structure members correctly because after setting the format, I use EM_GETPARAFORMAT and EM_GETCHARFORMAT flags to check if the changes was actually made, and it is (but just not displayed). This experience is really strange, I really don’t know what I am doing wrong or missing. And I can’t seem to find any examples on formatting text in a Rich Edit without using MFC. Any ideas on how to solve this or find any examples are greatly appreciated.
Thanks in advance
Aidman » over and out
We haven't inherited Earth from our parents, instead we have borrowed her from our children; an old Indian saying.
|
|
|
|
|
hehe... I found the problem, when I declared the PARAMFORMAT and the CHARMFORMAT structures I forgot setting them to zero, which caused the variable members (who wasn’t later set to any specific value) to have unpredictable values. Anyways it was a clumsy mistake
Aidman » over and out
We haven't inherited Earth from our parents, instead we have borrowed her from our children; an old Indian saying.
|
|
|
|