|
|
I've done some debugging,.. checking to see how the CControlBar is intergrated with MFC... I would really like to say thanks for pointing out that the source code for MFC was on my harddisk I didn't even know that.
I haven't any solution right now,.. and I have just started my vacation and will be leaving tommorow to see the WM for Tumbling/Trampolin the next 1½ weeks,... so there will be a pause before I can continue,... but as soon as I get back,.. I'll continue where I left off and notify you of my status.
thanx again
Peter Marino ( IO Interactive )
|
|
|
|
|
If I want to use in exa numbers (base 16)
Which is type of variable I need ? (int, double,BYTE or another) ?
|
|
|
|
|
Hexadecimal (base 16), commonly called hex (not exa), is a way to _represent_ numbers, not a way to store them. You can use any integer variable size you want - bytes, words, double words, etc. I suppose there is some use for hexadecimal floating-poi8nt values, but I can't imagine what it would be.
If you want to get hex representations of these numbers as strings, use the various forms of printf(). To get integer values from hex strings, use the strtoul() function.
Good luck.
|
|
|
|
|
|
I'm desesperated. I wanna make the scroll lock light blink.
I had these functions:
BOOL GetLight()
{
return (1&GetKeyState(VK_SCROLL)); //I tried GetAsyncKeyState and nothing
}
void SetLight(BOOL bState)
{
if(bState)
{
if(GetLight()) //Already on
return;
//Simulate the keystroke
keybd_event(VK_SCROLL, 0, KEYEVENTF_EXTENDEDKEY,0);
keybd_event(VK_SCROLL, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,0);
return;
}
if(!GetLight()) //Already off
{
return;
}
//Simulate the keystroke
keybd_event(VK_SCROLL, 0, KEYEVENTF_EXTENDEDKEY,0);
keybd_event(VK_SCROLL, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,0);
return;
}
OnTimer(UINT nIDEvent)
{
if(nIDEvent==ID_TIMER_BLINK)
{
if(BLINK)
{
SetLight(TRUE);
BLINK=FALSE;
}
else
{
SetLight(FALSE);
BLINK=TRUE;
}
}
}
I know the logic of the functions can be improved (ands, ors and whatever). Well, those functions work fine if you don't start threads in Windows 9x (in Windows 2000 the functions work fine with threads).
If I start threads in Windows 9x the blink period is perturbated and the GetLight function doesnt work correctly. I tried to use the AttachThreadInput function and nothing, the GetAsyncKeyState and nothing, Sleep times between keybd_event and nothing, what can i do???.
Please help me, I'm desperated.
Thanks in advance.
:confused:
|
|
|
|
|
As an aside to my last post I have a related question. If I wanted to populate a linked list in a function called foo would I be best to do this:
--
std::list<cperson> MyList;
obj.foo( & MyList );
--
(ie instantiate it on this side and pass a reference to the place where it gets filled.)
Or secondly, I ould do it like this:
--
std::list<int>* MyList = obj.foo;
std::list<int>* obj::foo() {
// fill list
return &list;
}
--
Now, the second one feels better, but there is an issue in that if I dont create the list inside foo on the heap then it will get deleted when foo finishes. But If I create it using new then does the returned pointer have the right to use delete etc as it doesnt "own" the object.
Thanks
|
|
|
|
|
Could some people give me some clues as to how you come up with classes etc in your programs??
I often have problems like this one Im having now - I want to change the status bar text from somewhere in my program (I think its the view class), but to do so I need to get at the m_wndStatusBar object which is instantiated in the main frame class. How can I possibly do something like this?? A lot of the time it would make sense to write an member function and call this from the view, but as I dont have anything a CMainFrame instantited in the view then obviously in this situation this would be no use.
Another problem I also have often is this. If for instance I am designing a Contact Management system. I might have two extra classes - a CContact and a CDatabase (to encapsulate the database stuff.) I have a button in a Dialog, (or a menu handler in the view) which is supposed to fill a linked list with CContact objects then what am I best to do. As I see it there are a few ways:
1. Instantiate CPerson objects in the dialog and pass them to the database class to fill?
2. Instantiate a CDatabase object in the CContact class and make this class call methods of the database transparently - so I can do MyPerson.GetPersonDetails() and the database stuff is transparent.
There are probably many more ways to approach the above problem too. But hopefully I made clear the problems I am having- basically decididng on which classes to use, deciding which classes should contain instances of other classes, and then when I have implemented this, what is the course of action if I need some info from a class which I dont have access to.
Any help on this subject would be . appreciated, and Im sure lots of other people must have the same kind of confusion on this topic too...
Thanks,
Ben
|
|
|
|
|
Hi,
I have a HBITMAP and want to get a Bitmapinfoheader structure from it, wo i can access the width and height members.
Anyone offer me any advice.
Cheers
Richard
|
|
|
|
|
to get a DIB from an HBITMAP you use GetDIBits. (a DIB is a BITMAPINFOHEADER followed by an image).
but if you just want the width and height, use GetObject.
[code]
BITMAP bmp;
GetObject(hBmp, sizeof(BITMAP), &bmp);
width = bmp.bmWidth; // etc.
[/code]
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Sorry, I am a new boy to this, may anyone of u tell me the answer, please, urgent! Many thanks!
Reguards,
will
|
|
|
|
|
here is what I got
treeDialob dlg;
dlg.m_edit.
//is there something I can put here to make it //disappear?
dlg.DoModal();
Thanks a lot!!
|
|
|
|
|
Hi,
CEdit *pEdit = (CEdit *)GetDlgItem(IDC_EDIT1);
pEdit->ShowWindow(SW_HIDE);
// pEdit->EnableWindow(FALSE);
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hello, the codegurus around the world.
CMyDialog dlg;
if (!dlg.m_edit.GetSafeHwnd())
MessageBox ("Sorry this", "Test");
dlg.DoModal();
Use the code - ShowWindow in BOOL CMyDialog::OnInitDialog (),
or use the resouce editor to take off the check box of Visible in m_edit.
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
Well, how do you do it then,
I want when the user clicks a certain radio button, an edit box to appear, but until the radio hasn't been clicked, to stay hidden?
|
|
|
|
|
Hello, the codegurus around the world.;)
Well, first of all, you should say clearly what you want.
I just created one radio button to show or hide the edit box.
If we open the dialog, the edit box is shown, and the radio button
title is "Hide the edit box".
If we click the radio button, the edit box disappers, and the raio button title is "Show the edit box".
After we click the radio button, the radio button is unchecked in two seconds.
void CSlidingDlg::OnRadio1()
{
CButton *rdButton = (CButton*)GetDlgItem (IDC_RADIO1);
ASSERT(rdButton);
CEdit *editbox = (CEdit*)GetDlgItem (IDC_EDIT1);
ASSERT(editbox);
editbox->IsWindowVisible() ? editbox->ShowWindow (SW_HIDE) :
editbox->ShowWindow (SW_SHOW);
rdButton->SetWindowText (editbox->IsWindowVisible() ? "Hide the edit box" : "Show the edit box");
Sleep (2000);
rdButton->SetCheck(0);
}
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
In the dialog resource, just untick the Visible property of the Edit control. Then, use ShowWindow(SW_SHOW) to show it again when the radio button is clicked.
> Andrew.
|
|
|
|
|
Wondering how to determine the number of elements stored in a CStringArray. I want to get back how elements hold data not how many it's capable of holding.
If I use SetSize(10, 5) to set the initial size of the array to 10 elements and then add 7 actual elements I get the following results.
GetSize() returns 10 while GetUpperBound() returns 9, when I want to get 7 and 6 respectively.
Is this possible?
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
|
|
|
|
|
I don't think a CStringArray knows how many strings you have added. It knows the size, but not how many of the pointers you actually use.
Why don't you use CStringList if you want that functionallity?
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Anders
cause I'm dumb, stupid and didn't know it existed. Now you have pointed it out to me I will look it up, but not until tomorrow. I have waited until midnight Sunday to get an answer, better get to bed if I'm going to make in it to work on time.
Once again thanks for the answer.
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
|
|
|
|
|
I am trying to package a reusable class library in a win32 dll
however I have run into a problem,
Class B and B2 derive from class A, heres the simplified code:
class __declspec( dllexport ) A
{
public:
A();
virtual ~A();
virtual void SomeFunc(void) = 0;
};
class __declspec( dllexport ) B : public A
{
public:
B();
virtual ~B();
void SomeFunc(void);
};
class __declspec( dllexport ) B2 : public A
{
public:
B2();
virtual ~B2();
void SomeFunc(void);
};
A::A()
{
cout << "A constructor." << endl;
}
A::~A()
{
cout << "A destructor." << endl;
}
B::B()
{
cout << "B constructor." << endl;
}
B::~B()
{
cout << "B destructor." << endl;
}
void B::SomeFunc(void)
{
cout << "B::SomeFunc()" << endl;
}
B2::B2()
{
cout << "B2 constructor." << endl;
}
B2::~B2()
{
cout << "B2 destructor." << endl;
}
void B2::SomeFunc(void)
{
cout << "B2::SomeFunc()" << endl;
}
This compiles into a DLL without any problems. However when
I attempt to use it (I have linked to the .lib and put the
.dll in the executable directory) using the following code:
#include "A.h"
#include "B.h"
#include "B2.h"
int main(void)
{
A* test = NULL;
test = new B();
test->SomeFunc();
delete test;
return 0;
}
I get the output as expected:
A constructor.
B constructor.
B::SomeFunc()
B destructor.
A destructor.
But then a nasty debug assertion failure:
Debug Asserion Failed.
File: dbgheap.c
Expression: _pFirstBlock == pHead
Oddly enough, if I comment out delete test; the assertion failure does not occur, but I dont want memory leaks in my programs. I know that converting it too a COM dll and using interfaces would problably be the best solution, however I want to first learn how to create normal dlls before I mess with making them COM compliant.
|
|
|
|
|
Have you tried calling delete []? Call it with the brackets and see if the same problem occurs.
|
|
|
|
|
Check if the DLL is built with the same C runtime
library version as the program you're using it from
(i.e. Multithreaded or not, static ot dynamic, debug
or release). If versions differ this kind of problems
can occur
|
|
|
|
|
Does anyone here know the commands for the CHttpServer and how to use it? I was just curious...
"The world doesn't care about your self esteem. The world expects you to get something done BEFORE you feel good about yourself." ~ Bill Gates
|
|
|
|
|
|