|
I am trying to find a way to send an interrupt to a process. I have put a GUI around a "console application" and redirected its output to the GUI. Now I need a way to send a CTRL-C to the "Console App".
Any help would be greatly appreciated.
Thanks
DCrawford999
|
|
|
|
|
|
It's a bitch!
Anyhow here is the thing I got myself a string, just a word.
I need to locate a char in it and then erase it, also it must be done in a loop so that if char is in there twice etc. it would be deleted.
Problem: What if char doesn't exist in the string.
I tried to use if( !(blahblah.find(char)) ) doesn't work because if .find
doesn't see the char it throws the value of char position out of range of length of string or drops it bellow zero, causes an out of range error.
(This took me half a day to figure out)
So I used: if( (blahblah.find(char) < 0) || (blahblah.find(char) => Length) )
same crap!
Two hours later found strpbrk()!
How can I use it together with strlen to simplify the condition and avoid
out of range error during run-time.
Basicaly what I need is to look at a string, single word. Check if it has a char I provide. If it doesn't I need the if-statment to fall thru.
But if it does have it I need to erase it, this I can do .
|
|
|
|
|
if (strchr (blahblah, char))
eraseit ;
Is this what you are looking for?
|
|
|
|
|
Thanks!!!
|
|
|
|
|
CreepingFeature wrote:
...I got myself a string...
Would that be an STL string or an MFC CString?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Interestign question for you all to mull over. I'm using a CListCtrl to display a large number of image icons, and I need to be able to force the number of icons (in LVS_ICON style) to be displayed to be 8 per row regardless of the control size, ie to have both vertical and horizontal scroll bars.
Anyone got any ideas?
Thanks in advance, John.
|
|
|
|
|
This is an untried wild guess, but could you use CListCtrl::SetItemPosition and locate them manually? You could also take a look at CListCtrl::ApproximateViewRect and the MSDN article "Implementing Working Areas in List Controls"
|
|
|
|
|
Hi,
I am developing a software .....for that I have to open matlab inside a view port. For this reason I am using the parent and child functions and window handles. But it works perfectly with program like winword, notepad , internet explorer .... but not for matlab ..... it is denying to be a child window .... and going outside ...... I have also used the class name of Matlab's main window to find the handle of it .... even then it goes outside ..... can any body help me with this problem .... I just wanna open matlab inside my view port and it will remain there without exchanging any data to the main program ........
Sangit
|
|
|
|
|
Hello,
I wish to have a combo box for which the window text is always the same. For example, the text of the combo box is "Select Widget". When the drop down button is clicked, a list of widgets should appear; after a widget is selected, the combo box should once again show the text "Select Widget", rather than displaying the selected widget.
I have tried simply using SetWindowText on the CComboBox object, but that did not work.
Might anyone have a bit of sample code doing this?
Thanks
|
|
|
|
|
[Shameless plug]
You might want to consider using a FooButton[^] whose caption is "Select Widget". When the button is clicked, display your widget selection menu as described in the section "Displaying a popup menu".
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I may recode it to do just that if I am unable to get the combo box to work.
Using the FooButton is slightly more complicated for me as the button would be on a toolbar and I would need to call Create() for it myself.
I appreciate the input.
|
|
|
|
|
The combo box sends a change event message whenever someone makes a selection. If you override this message, you can then (a). handle that selection, then... (b) reset the selection to the 'Select Widget' text.
Have a look at the various event messages sent from the class wizard to override.
I Dream of Absolute Zero
|
|
|
|
|
The problem is that I don't want a "Select Widget" selection to appear as a choice when the combo box drops down.
Thanks for your input.
|
|
|
|
|
I think I got all my thinking wrong with my current work.
I did want to overlay bits, ints and floats with an integer array, but having just checked that only the first item in the array is being used.
The test I uesed was
typedef struct<br />
{<br />
unsigned short x;<br />
unsigned short y;<br />
unsigned short z;<br />
}MyStruct;<br />
<br />
union <br />
{<br />
MyStruct data;<br />
unsigned short buffer[32];<br />
}overlay;
If I change x, y or z then only buffer[0] is affected and x, y, z all take the same value.
Does anyone have a suggestion as how to do this sort of thing;
e.g.
Have a structure such as:-
1 bit;
2 bits;
8 bits;
float;
int;
short;
unsigned short;
3 bits;
long;
and overlay it with an array such as unsigned short buffer[32];
So that you can use the buffer (to send the data) and the other items can be modified directly in the program (and changes reflected in the buffer).
Otherwsie a lot of code will need written.
Hlp!?!
|
|
|
|
|
Hello everyone,
My VC++ application is currently polling a digital input from a digital I/O card and perform some task if the signal is logic high. The card can be configured to generate a hardware interrupt (i.e. IRQ 2~7) on input logic-level change through jumper settings. Can anybody give me some idea on how to add codes to detect the hardware interrupt in NT systems? Do we need DDK to intercept the hardware interrupt?
Thanks..
|
|
|
|
|
You need a device driver, see the DDK documentation if you want to write one.
Does the card come with one? many times you can get the driver from the manufacture (and if you can't you should ask why not). If they provide the driver you need to ask them how to interface to it.
|
|
|
|
|
Thanks for the reply. The card comes with bunch of DOS-based libraries to access all of its functions and the manufacturer don't have driver support for Windows. Can you give me a link on where to start searching for examples on how to intercept a hardware interrupt?
Thanks in advance.
|
|
|
|
|
I couldnt even load the image..im getting errors..can anyone help me to load, display and convert an image to grayscale in c++? thank you in advance
|
|
|
|
|
|
I defined a structure called STUDENT in one header file, and I
need to use that data type in another header file. Normally,
if it was just a global variable, I could have just used extern,
however, in this case, what should I do?
Thanks
//bitree.h
<code>
typedef enum MAJOR_t {
CS, MIS, ME, PHI
} MAJOR;
typedef struct STUDENT_t {
char name[64];
unsigned int ID;
char sex[2];
MAJOR major;
struct STUDENT_t *left;
struct STUDENT_t *right;
} STUDENT;
// another header file
<code>
STUDENT* Load(FILE *fp);
void Save(STUDENT* node, FILE* fp);
-----------------------------
C++ without virtual functions is not OO. Programming with classes but without dynamic binding is called "object based", but not "object oriented".
|
|
|
|
|
Just include your header file, bitree.h, in the file that needs to use it.
A simple #include "bitree.h" , at the top of the other header file should do the trick.
I Dream of Absolute Zero
|
|
|
|
|
Yes, I included it, but I got an error. Then I combined them
into one header file, it was fine, but that was not what I
intended to. I want to make them into two seperate header files.
Any idea?
-----------------------------
C++ without virtual functions is not OO. Programming with classes but without dynamic binding is called "object based", but not "object oriented".
|
|
|
|
|
Alex Ngai wrote:
I want to make them into two seperate header files.
Having separate definition files for your classes and structures is a common practice. But in order to use the structures and classes defined in one file in another, it needs to be made aware of its existance. Now if you are getting errors on inclusion, then may need to look at the way it is being included (maybe definition conflicts between both files).
Alex Ngai wrote:
Yes, I included it, but I got an error.
What's the error message, and how are you including the file?
I Dream of Absolute Zero
|
|
|
|
|
add in your header files
#pragma once
or
#ifndef __MY_UNIQUE_FILE_IDENTIFIER_RELATED_TO_THIS_FILE_<br />
#define __MY_UNIQUE_FILE_IDENTIFIER_RELATED_TO_THIS_FILE_<br />
<br />
<br />
<br />
#endif
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|