|
I have a problem. I am trying to catch some exception and I still haven't succeded. I tried with very simple example but still isn't working. Cakb someon help. Here is the code;
try
{
int a=5, b=0, c;
c = a/b;
}
catch (CException* e)
{
MessageBox("Division by zero exception!");
}
My program ends with error without executing the code in catch block.?????
|
|
|
|
|
try
{
int a=5, b=0, c;
c = a/b;
}
catch (...)
{
MessageBox("Division by zero exception!");
}
|
|
|
|
|
You can use of this code
try
{
int a=5, b=0, c;
if (b == 0)
throw int();
c = a/b;
}
catch (int)
{
MessageBox(_T("Division by zero exception!"));
}
|
|
|
|
|
See this[^] article on MSDN about exceptions. The first example illustrates handling divide-by-zero handling.
Software Zen: delete this;
|
|
|
|
|
Can I be able to convert VC++ builtin header files to DLL file.
As an experiment i tried in math.h but failed to create a dll.As build log said unable to register dll and dll was present no where.
And also how can i export my constants.Is that also possible?
Am I lacking a perfect picture of the whole thing DLL is doing?Help me please
|
|
|
|
|
You can't 'convert' header files into DLL's. A header file describes the contents of a DLL. A given header file may describe only part of a DLL. For example, math.h describes math-related functions in the C runtime library. The actual DLL in this case is MSVCRT.dll, which is usually installed in C:\Windows\System32.
You shouldn't need to do anything to create this DLL; it's installed as part of Windows, since so many Windows-supplied applications and components use it.
If you have general questions on creating and using DLL's, this[^] is an entire section of Code Project devoted to the subject.
Software Zen: delete this;
|
|
|
|
|
Can Anybody Tell me How to use picture Control.
I need to dynamically load the image on that picture Control.
Using Win32 Application
|
|
|
|
|
Can you more explain about picture control? for load images see OleLoadPicture and if your images are bmp you can use of LoadImage of course if your program was MFC you could use of CImage class if you want to assign a image to a control you can use of CStatic control on the toolbox when you insert this control to your program it has a function SetBitmap(with hbitmap handle) that you can show your image.
|
|
|
|
|
A picture control is a static control with the SS_BITMAP, SS_ICON, or
SS_ENHMETAFILE style.
To set the control's image you can use the STM_SETIMAGE message
(I'll assume you're using the SS_BITMAP style):
HBITMAP hNewBitmap = ...;
HBITMAP hPreviousBitmap = ::SendMessage(hwndPicConrol, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hNewBitmap); Where is the image coming from that you want to set to the control?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thnk you for reply. But how do i get the handle to picture control. i.e hwndPictureControl
|
|
|
|
|
If you created the control with CreateWindow[Ex]() then the API will return the handle.
If the control is on a dialog created from a dialog resource, the you can use GetDlgItem()
to get a handle to a dialog control given its ID.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
hi all
I want load GIF file in the touro c++ but I don't know how I can
do its
plz hellp me
thanks alot
bye
|
|
|
|
|
mahideh wrote: in the touro c++
Are you using the windows APIs?
- NS -
|
|
|
|
|
I should use from GIF format file for load its in to DOS
but I don't know how I use from LZW code for decode data of image and draw image in consul
|
|
|
|
|
For see detaily of graphic formats and how to read and open them see CXImage class on the codeproject maybe it will be helpful for you.
|
|
|
|
|
If you can use Windows APIs, you could use GDI+[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Can any body tell me how can i extract all the links from
the html data.
any standard protocol to get the link from the data.
or all posible ways for url in the data absolute url or relative url.
|
|
|
|
|
you can use regular expression to extract the url from the html data.i have done this before but not in c++,just in java.
|
|
|
|
|
hi thanx but i want it in vc++
any way thanx
|
|
|
|
|
There are also some regex library in c++.
|
|
|
|
|
The Boost library includes a very nice regular expression[^] library for use from C++. Documentation and examples are good. You can probably Google for a site that lists regular expressions for extracting information from HTML.
Software Zen: delete this;
|
|
|
|
|
Host the document in MSHTML and use the anchors property of the IHTMLDocument2 interface.
|
|
|
|
|
Dear Friends,
I m trying to write one application to get Oracle reconnection. But i m not getting reconnected.
What can be a problem?? can anybody help me??
megha
|
|
|
|
|
Come on !
How could expect one to know, what exactly is problem ? Explain, what you are trying ? And where you are stuck ?
Prasad
MS MVP - VC++
|
|
|
|
|
Ohh yes.... sorry boss..
Here is the problem..
while reconnecting i m trying to execute a query to check whethere i got connected to DB or not??
That query returns me true which means i m connected to Database. Now i want to update some records from file to DB and at that time i m getting "OERROR_INVPARENT" error.
My question is how it can return me two different things at two different places.
Did u get my problem now??
|
|
|
|