|
|
It's finally starting to sink in. I took one more pass through the WaitCommEvent documentation, and caught the one sentence I missed before... "When this happens, the system sets the hEvent member of the OVERLAPPED structure to the not-signaled state before WaitCommEvent returns" I missed that the previous 10 times I read it!
Thanks again.
|
|
|
|
|
|
I created a deskband and when I turn it on, it is checked. Is there a way to prevent it from becoming checked? I have put in the capability to have more than one band, but I can't create new ones because of this problem.
Thanks
|
|
|
|
|
in my program i have a linked list, which is circular and i need to print out the numbers in the list from a given number.
the number i have to print from is the third number (62) in the list (as shown below) to the end then it has to rap back around and print the first two numbers.any suggestions
92 82 62 72 99
it needs to print out
62 72 99 92 82
[code]
void ClosedList::PrintFrom(int item) const
{
NodeType* currPtr = head->backlink;
NodeType* newNodePtr = new NodeType;
newNodePtr->component = item;
newNodePtr->backlink = currPtr;
currPtr = newNodePtr;
newNodePtr = NULL;
if(!IsEmpty())
{
do
{
cout << currPtr->component << " ";
currPtr = currPtr->backlink;
}while (currPtr != head);
cout << currPtr->component << " ";
}
cout <<endl;
}
bool ClosedList::IsEmpty() const
{
return (head == NULL);
}
[/code]
|
|
|
|
|
If the list is circular, you need to remember the address of the starting point and check for that, so you know when you've looped around.
I'd write an iterator class, and then provide a method of using it to loop the list. I'd also make the print stuff an iostream inserter ( I have an article on this on the site ).
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
You need something like this:
struct List { List * next; void * data;};
// Walk to the nth node of the list.
List* walk_n(List * lst, unsigned n)
{
for(unsigned i=0; i<n; ++i) lst = lst->next;
return lst;
}
// Walk the list calling fn on each node (until
// the list loops back to the beginning)
void listWalk(List * lst, void(*fn)(void* data))
{
List * last = lst;
do
{
fn(lst->data);
lst = lst->next;
} while (last != lst);
}
With these two functions (which I made general since your
application serves best as a composition of general functions)
you can easily provide your required functionality.
void printFromN(List* lst, unsigned n)
{
listWalk(walk_n(lst, n), printFunction);
}
where print function is some function to output the data
in a list node.
Needless to say, this code is untested, as I just typed it,
but, although there might be a few typos, I hope it communicates
the basic idea.
Of course I have assumed no null lists, that is a whole other
subject that depends on exactly how you are defining your list
structure.
HTH
|
|
|
|
|
Hello,
I am creating a splitter window application where one of the windows is a CHTMLView view (in other words, a web browser). I was wondering if it is possible to put a control bar inside this splitter window, so that I can put labels and textboxes on it.
Does anyone know if this is possible? I was looking at Outlook Express, and it seems to have just that: in the splitter window where the email message is displayed, there is some sort of controlbar where the addressees and subject are displayed.
Does anyone know how to do this?
Thanks,
Trimtrom
|
|
|
|
|
some time mouse shows busy sign(or it is busy).
can any body tell how i may check that mouse is busy or not?
r00d0034@yahoo.com
|
|
|
|
|
errrrr if its eating cheese i guess its busy
otherwise it isnt
(ps: mice dont get busy the computer does)
"traffic lights are for people who can't make their own decisions" biz stuff about me
|
|
|
|
|
*grin* Yes, Imran does ask the same questions over and over again and gives the impression that he has no idea how to search for things himself. In this case, I had just finished explaining that you could poll the mouse position twice and see if it changes before I realised what he meant. Seeing as the busy cursor is just another cursor you set the mouse to, I am not sure there is a way to tell that this is the cursor being used, but I'm not sure.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
i could not understand wht you say .
plz explain it?
r00d0034@yahoo.com
|
|
|
|
|
I think she's pointing out that the mouse is never busy, it simply shows that the computer is. The rest of the comment was about real mice, living animals, and was obviously meant as a joke. ( Naturally, lauren is free to correct me here ).
I think it may be a little unfair to comment on your grasp of English, but I also think you bring it on yourself, because you seem to ask the same questions over and over, and the net impression is that you're feeding us your projects a bit at a time and not really looking to learn anything yourself. You should check msdn.microsoft.com as a bare minimum before postinmg a question, that site will answer pretty much every question you've asked about the WinNT login sequence, for example.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
any LogiTech webcam programmer here? QuickCam SDK?
norm
|
|
|
|
|
I dont know anything about the QuickCam SDK, but dont those devices have a TWAIN interface?
|
|
|
|
|
i downloaded the SDK and started playing with it. The samples are very simple and client implementation almost seems trivial - which is good.
I compiled the project and there's no compile time error and things looked good. The only problem is that it "cant connect to camera" (not using exact phrase here) for some reason. I have re-installed my webcam as well as the SDK and still have the same problem - well, i guess i will have to try do this on a different machine... more, the software that came with the webcam worked as normal. no error no nothing. but the sample project that came with the SDK didnt work for some reason (connection to camera)...
My question is: if u have experience with logitech webcam SDK, it'd be helpful if u can tell me such and such are the usual cause for problem associated with camera connection.
here's the URL:
http://developer.logitech.com/developer/
Thanks.
norm
|
|
|
|
|
one cool feature that comes with the logitech quickcam: motion detection =)
it would be cool if u can access the video/individual frames in realtime (image processing)... but perhaps that cant be done with avi.
i think u prolly need to do this by taking a sequence of still shots (jpeg or whatever format it supports) and process each frame individually... anyway, cool toy
norm
|
|
|
|
|
|
Hey guys
I have a CWinThread thread that I start off from a service. I also show a modeless dialog from this thread. My intention is to use SetThreadDesktop and to bring up the dialog box in one of the active virtual desktops. But my problem is that SetThreadDesktop fails and my dialog comes up in the current desktop. If I convert this to a worker thread (using CreateThread ) and then bring up my modeless dialog it works fine (I provide the message pump myself).
The document of SetThreadDesktop says this :-
The SetThreadDesktop function will fail if the calling thread has any windows or hooks on its current desktop (unless the hDesktop parameter is a handle to the current desktop).
My guess is that MFC threads do some hooking of their own and this is why SetThreadDesktop is failing. Does anyone know of any work-around to this issue?
Regards,
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Don't know if this is going to help you, but in case you are playing with a service, make sure to check the "interactive user" in the service properties (this can be done programmatically as well).
|
|
|
|
|
.S.Rod. wrote:
Don't know if this is going to help you, but in case you are playing with a service, make sure to check the "interactive user" in the service properties (this can be done programmatically as well).
Yup, that option is already set
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Hey everyone!
Okay, I need to know how to pass an instance of a class as a parameter for a constructor, and then have that constructor call the constructor of the supplied parameter. Kinda like this piece of code:
class classA
{
public:
classA (int somevalue, classB classBInstance);
void wasteTime ();
private:
classB *classBInstanceCopy;
};
class classB
{
public:
classB () { };
classB (int somevalue);
int something;
};
classB::classB (int somevalue)
{
something = somevalue;
}
classA::classA (int somevalue, classB classBInstance) : classBInstance (somevalue)
{
classBInstanceCopy = &classBInstance;
}
void classA::wasteTime ()
{
printf ("Hey, how about a %d?", classBInstanceCopy->something);
}
void main ()
{
classB myInstance;
classA myClass (myInstance);
myClass.wasteTime ();
}
I think you get the idea: I wanna have a class where the constructor takes another class as a parameter, call the constructor of that class and then later be able to reference that supplied class. How is that possible? I'm sure there's some way using pointers, but how? Oh, and anyone know how I can get rid of that empty classB constructor? As far as I understand it's only there so I can create an instance of classB in the fassion of "classB myInstance". So, if anyone has an idea, let me know!
Thanks
tilli
|
|
|
|
|
There are several solution. One solution is template.
ClassB<classa> cbObject;
template<typename t="">
class ClassB
{
...
T *Create();
};
template<typename t="">
T* ClassB::Create()
{
T *pT = new T(// Parameter);
return pT;
}
Kuphryn
|
|
|
|
|
Thanks for the reply! Now I'm not really familiar with templates, so for my special case, where I want the parameter passed to be a descendant of classB (so something declared class classWhatever : public classB), what do I need to do? I can somewhat see the use of templates here, I would probably put a templated class instance into classA and then have classA have called that instances constructor, based on what type of class was passed to classA's constructor. Where do I need to make the changes then?
Tilli
|
|
|
|
|
Okay, this seems to do it just as well:
template <class clType>
class classA
{
public:
classA (int somevalue);
void wasteTime ();
private:
clType classInstance;
};
class classB
{
public:
classB () { };
classB (int somevalue);
int something;
};
classB::classB (int somevalue)
{
something = somevalue;
}
template <class clType> classA<clType>::classA (int somevalue) : classInstance (somevalue)
{
}
template <class clType> void classA<clType>::wasteTime ()
{
printf ("Hey, how about a %d?", classBInstanceCopy.something);
}
void main ()
{
classB myInstance;
classA<classB> myClass (myInstance);
myClass.wasteTime ();
}
Looks good? Alright! Thanks for the hint!
Tilli
|
|
|
|