|
Sarvan AL wrote: I moved the code "SetIcon(..)" into OnPaint(). Now it works.
You are using OnPaint for the wrong reasons.
Nibu thomas
Software Developer
|
|
|
|
|
Sarvan AL wrote: SetIcon(m_hIcon, FALSE) ;
Move this to OnCreate . If you use it here it will assert because the window handle is not created. It is just in PreCreateWindow stage.
Nibu thomas
Software Developer
|
|
|
|
|
I have captured video from webcam and displayed in my dialog.
How can i stop capturing video and disconnect webcam ,when i press Stop button?
JAYARAJ
|
|
|
|
|
J5121982 wrote: I have captured video from webcam and displayed in my dialog.
How?
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
|
MFC doesn't have any functions to handle webcam either you are using DirectX or some third party SDK for this, please specify or paste some code.
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
Hi All,
I have a small problem with the code snippet below. Can anyone help me out in this. I launched Internet Explorer as a process from my application. I closed the Internet Explorer using the close button and when I use the following code of "OpenProcess", the method still works(meaning that the method is able to the open the process with the specified ID.
HANDLE p = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcessIdentifier);
if(p != NULL)
MessageBox(_T("Please check patient context"),_T("EDMS context change"),MB_OK);
can anyone give some info on this please.
|
|
|
|
|
Please try the below method
HANDLE p = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcessIdentifier);
DWORD dwEitCode = 0;
if( 0 != hProcess)
{
GetExitCodeProcess( p,&dwEitCode );
if( ( STILL_ACTIVE == dwEitCode )
{
// process is alive
}
else
{
// process is dead
}
Closehandle( p )
}
nave
|
|
|
|
|
Thanks Naveen. Its working as expected.
Could you please tell me what was wrong with my code that I used. I had also checked for NULL of that Handle returned right?
|
|
|
|
|
I too don't know.
But just think.. if OpenProcess return NULL if the process dosen't exists, what's the significants of GetExitCodeProcess() api..
I too was facing the same problem some months back.
nave
|
|
|
|
|
i want to query to a particular URL and return back to answer from this URL through programming if anybody have idea for this please share with me its urgent.
Bankey Khandelwal
Software Engineer
|
|
|
|
|
Bankey Khandelwal wrote: its urgent
ok here it is.
BOOL GetWebContent(LPCTSTR szURL, CString &strData)
{
strData = "";
HINTERNET hConnection = InternetOpen("Microsoft Internet Explorer",
PRE_CONFIG_INTERNET_ACCESS,
NULL,
INTERNET_INVALID_PORT_NUMBER,
0);
if (hConnection == NULL)
return FALSE;
DWORD dwSize;
CHAR szHead[] = "Accept: */*\r\n\r\n";
char *szbuf;
HINTERNET hConnect;
if (!(hConnect = InternetOpenUrl(hConnection,
szURL,
szHead,
lstrlen(szHead),
INTERNET_FLAG_DONT_CACHE,
0)))
{
InternetCloseHandle(hConnection);
return FALSE;
}
BOOL bReadInParts = FALSE;
DWORD dwNumberOfBytes = 0;
if (InternetQueryDataAvailable(hConnect,
&dwNumberOfBytes,
0,
0)){
if (dwNumberOfBytes < 0){
bReadInParts = TRUE;
}
else{
szbuf = new char[dwNumberOfBytes+1];
if (!InternetReadFile(hConnect, szbuf, dwNumberOfBytes, &dwSize)){
bReadInParts = TRUE;
}
if (dwSize < dwNumberOfBytes+1)
szbuf[dwSize] = '\0';
strData = szbuf;
delete []szbuf;
}
}
if (bReadInParts){
szbuf = new char[512];
do{
if (!InternetReadFile (hConnect, szbuf, 512, &dwSize)){
return FALSE;
}
if (!dwSize)
break;
if (dwSize < 512)
szbuf[dwSize] = '\0';
strData += szbuf;
} while(1);
delete []szbuf;
}
InternetCloseHandle(hConnect);
InternetCloseHandle(hConnection);
return TRUE;
}
*sorry about the crappy formating copied from production code
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
thanks.
but now problem is that ,this code return html conversion of given url but i want server side script output.
for example:
i have to passed a url and on the server script will run and then i want output of this script.
Bankey Khandelwal
Software Engineer
|
|
|
|
|
what is the script output?
can't you embbed the script in a webpage and output html itself.
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
Is there any way to change the colour of a HICON object at runtime without creating a new bitmap? Is there any way to get a pointer/reference to a HICON's colour palette info to modify?
Essentially what I need is for the users of a program to be able to change the colours of individual item icons on a tree control at their will.
When I die I'd like to go peacefully in my sleep like my father, not screaming in terror like his passengers!!!
|
|
|
|
|
typdef struct
{
BITMAPINFOHEADER icHeader;
RGBQUAD icColors[1];
BYTE icXOR[1];
BYTE icAND[1];
} ICONIMAGE, *LPICONIMAGE;
you can use it to modify the bitmap
this[^] page gives more info.
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
Thanks for the link.
When I die I'd like to go peacefully in my sleep like my father, not screaming in terror like his passengers!!!
|
|
|
|
|
What is WindowProc and how can i use it. Can anyonepls show a sample code where it is used.Is it a callback function?
|
|
|
|
|
WndProc[^]
Nibu thomas
Software Developer
|
|
|
|
|
AS far as I can understand what you want to ask is that who call's WindowProc function.Is it right?
The Operating system calls a callback function as it receives WM_TIMER message time and again
The syntax of the function is
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
Vision is Always important and so is your ATTITUDE.
Wishes.
Anshuman Dandekar
|
|
|
|
|
AnShUmAn_VCPP wrote: The Operating system calls a callback function as it receives WM_TIMER message time and again
yeah right
get a good win32 book
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
|
Greetings!
I know it's a long shot and please don't mock me if I missed it completely.
Suppose I get some config file called objects.txt. It includes lines like:
phonenum|1003
colour|red
vehicle|truck|mack
first string on the line is name of object type and all the rest are parameters. In my program I would like to read file objects.txt line by line and do the following:
if "I know-type" phonenum {
new phonenum(1003);
} else if "I know-type" colour{
new colour(red);
} else if "I know-type" vehicle{
new vehicle(truck, mack);
}
Is that even possible? To check the type at run-time?
Before you dissmiss me complitely I'd like to explain what I would like to achieve. Maybe you will know some other solution to the same problem.
I'd like to make some kind of save/load, serialize/deserialize framework. It would provide capability to store and load user defined objects. All objects would be serialized and stored in one file (configuration for the whole user defined system). Framework would gather ojects trough some common interface
addObj(abstractObj obj*);
every user defined object would have to implement methods
char* serialize(void);
void deserialize(char*);
when framework is asked to save objects, it would call "serialize" method of all objects it contains and save them line by line. When framework is asked to load configuration he would read the file line by line and read the type of object and create it, than call its "deserialize" method with the rest of the line characters.
I already used the serialize/deserialize pattern before. But in that particular implementation I knew all the types compile time. For example:
if (line == "phonenum"){
new phonenum(1002);
}
...
here I already know what types I expect. I'd like to do implementation when I don't already know all the names infront at compile time. I'd like to read the "name" run-time and check if I know it. This way I'd really have true framework which should not know any user defined types at compile time.
Best regards,
Rostfrei
|
|
|
|
|
Will typeid help you?
Code sample from MSDN :
class Base {
public:
virtual void vvfunc() {}
};
class Derived : public Base {};
using namespace std;
int main()
{
Derived* pd = new Derived;
Base* pb = pd;
Base b;
cout << typeid( b ).name() << endl;
cout << typeid( pb ).name() << endl;
cout << typeid( pb ).name() << endl;
cout << typeid( pd ).name() << endl;
cout << typeid( pd ).name() << endl;
delete pd;
}
Nibu thomas
Software Developer
|
|
|
|
|
the problem here is in "new Derived;". When I would do that I would already have to know which derived class it is.
Rostfrei
|
|
|
|