|
I don't know what this has to do with a tree control, but your Create() call is missing some windows styles (specifically WS_CHILD ), and your control does not have an id. See the documentation[^] for more details.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
At least show us the code you use to create the Tree Control
|
|
|
|
|
please show your CTreeListCtrl creation code. without seeing code how we can predict issue? 
|
|
|
|
|
Hi All.
I need to your help in blow questions..
I have to use internet over GPRS modem in windows xp and windows 7, so i have created a dial-up connection using Rasdial API
But i get some problems.
that is, when i creat Ras entry by RasSetEntryProperties api, the entry come up with the default maximum speed of 115200 (but i must use other baud rate, for example, 7200000) .
I can edit this manually in the modem settings, but dose anyone know the API's i can use to set it in code?
I don't want to modify registry about modem.
I have looked through the MDSN, but RasSetEntryProperties function dosen't do it, and it says, lpbDeviceInfo param is unused in Windows XP.
Are there any other solutions except modify registry before making ras entry?
Sorry for my bad english.
Regards.
|
|
|
|
|
This looked easy but it wasn't
I want to
1/ Test if I have rights to delete a file
2/ lock it
3/ read it
4/ delete it
This is all in one process
Gave up on 1/ but tried to use CreateFile to lock it and found xerces-c was not able to access the file for reading in the same process.
Any pointers (no pun intended). Not .net just C++/Win32
Thanks
Iain
|
|
|
|
|
Iain Wiseman wrote: and found xerces-c was not able to access the file for reading in the same process. You really need to explain that in technical terms, i.e. what code you used and what errors you received. I'm not sure about item 1, but 2,3 and 4 are quite straightforward in Windows.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
I want to disable other processing from locking the file.
When I use CreateFile, this works except it also prevents Xerces from reading the file so the code looks a little like this
m_Handle = CreateFile(
TEXT(inFullyQualifiedPath.c_str()),
GENERIC_ALL,
0,
NULL,
OPEN_EXISTING,
NULL,
NULL);
m_ConfigFileParser = new xercesc::XercesDOMParser;
m_ConfigFileParser->parse(m_Filename.c_str());
The reading of the file fails because Xerces cannot open the file.
|
|
|
|
|
Solved by using
GENERIC_READ and FILE_SHARE_READ | FILE_SHARE_WRITE
|
|
|
|
|
Iain Wiseman wrote: FILE_SHARE_READ | FILE_SHARE_WRITE You do understand that those options allow other processes to read and write the file at the same time.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
If this isn't correct then is there something that is?
It seemed to work when I ran a separate process with the same code and put a pause in it.
I totally sure you are right. If you do know the right combination I would be grateful. It seemed such a simple thing to want to do.
Iain
|
|
|
|
|
Sorry, I'm not sure exactly what your problem is. You said it works now, I was just pointing out that those options mean you do not have exclusive access to the file.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
I am simply after in one process being able to prevent someone else opening a file whilst I am reading it. I do not have control over the opening of the file as this is done within the Xerces library. The file is an xml file hence the use of xerces. Once I have completed the read I want to sometimes delete the file.
Ideally I would have like to in my process
Check I have exclusive rights to the file
Read it using xerces
Delete it
|
|
|
|
|
A Simple work around to your problem would be use your original code to get the exclusive access to file,
Read the file and create a temporary file which you can pass it to Xerces.. later delete the temp file.. and if you want delete even the source/original file.
Other alternatives could be to check if xerces takes text(some temp buffer) as input instead of file name.. so you can read the file in buffer and pass it to xerces.
|
|
|
|
|
Iain Wiseman wrote: I do not have control over the opening of the file as this is done within the Xerces library. In that case there is nothing you can do to gain exclusive access to it. I have no experience of the Xerces library, but are you sure there is no option to pass the handle of a previously opened file into it?
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
I did in the end copy the file to a temporary file which gets destroyed on destruction.
Thanks all for your help.
|
|
|
|
|
|
I don't think this should be addressed to me.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Don't you read the file if the access is denied to delete it?
Otherwise, simply try to delete the file using DeleteFile. It will give you ERROR_ACCESSDENIED return code if it fails.
Alternatively you can check the File Security information Check Here[^]
-Sarath.
Rate the answers and close your posts if it's answered
|
|
|
|
|
I AM A LITTLE BIT EXPERIENCED WITH C PROGRAMMING AND PICS BUT AM WONDERING IF ANYONE OUT THERE CAN HELP WITH THE CODE TO RUN A PIC16F8777A OR AN ARDUINO WITH TWO IR SENSORS S1 AND S2 TO PERFORM BIDIRECTIONAL COUNTING IN AND OUT. IN THE FIRST SEQUENCE BREAKING FIRST S1 AND THEN S2 WILL TELL THE MICROCONTROLLER TO INCREMENT THE COUNTER WHILE BREAKING THE SECOND SEQUENCE, FIRST S2 AND THEN S1 WOULD TELL THE MICROCONTROLLER TO DECREMENT THE COUNTER.THE MICROONTROLLER SHOULD ALSO STORE AND TIMESTAMP THE COUNTS AND BE ABLE TO PASS THE TIMESTAMPED DATA TO A REMOTE COMPUTER VIA BLUETOOTH OR WIFI.
ANY HELP WILL BE GREATLY APPRECIATED.
THANK YOU.
|
|
|
|
|
Are the sensors tied to a GPIO line or do you have to talk to them using IIC or SPI? Need a little more info about the sensors before I could offer more assistance. I'm familiar with ARM (mostly Freescale and Atmel stuff) and I'd say that the sensors that I work with are generally tied to a GPIO pin. In that case you just need to read the GPIO pin status or tie it to an interrupt and read them in your app. The logic handling should be simple enough, if S1 is tripped before S2 then increment your counter and log the event to whatever permanent storage you are using, and decrement if you see the sensors in the opposite order. Not having much experience with PIC parts I don't know the exact registers you would need to check for the GPIO status though.
|
|
|
|
|
I am tieing a pair of infrared sensors S1 and S2 onto GPIO lines(digital I/O) of any microcontroller that is easy to program in C as I am new to this.I am looking into ARDUINO UNO(ATmega328 MCU),ARDUINO MEGA(ATmega1280) or a PIC16F877A.I will use the Microcontroller to read the interrupts from the sensors as they change on being broken in the sequence mentioned before.
My main problem is the real coding in C of the logic onto my app.
Can you help with the code?? I wish to have the following functionality:
1) Read interrupts from sensors
2)Increment or decrement counter depending on sequence they are broken
3) timestamp the count and enable storing
4) Pass timestapmed data onto a remote host computer via bluetooth or Wifi.
Do you suggest any parcticular Microcontroller for this application?
Thank you very much.
|
|
|
|
|
Try something like the following for your interrupt handlers. Depending on the micro you select, how to install these will be different. I would stay away from PIC parts, I personally don't like them. The Atmega family of MPU should be better to work with in my opinion, although my personal favorite these days is the Freescale Kinetis family of MPU's. You can get demo boards in the form of expandable towers from Freescale.
[EDIT] You may also want to handle rollover for the counter variable if you expect to have counts high enough for this to happen.
#define S1 (1 << 0)
#define S2 (1 << 1)
unsigned char sensorFlags = 0;
int counter = 0;
void s1_isr(void)
{
if(sensorFlags & S2)
{
--counter;
sensorFlags &= ~S2;
}
else if(sensorFlags & S1)
{
}
else
{
sensorFlags |= S1;
}
}
void s2_isr(void)
{
if(sensorFlags & S1)
{
++counter;
sensorFlags &= ~S1;
}
else if(sensorFlags & S2)
{
}
else
{
sensorFlags |= S2;
}
}
modified 7-Nov-12 14:05pm.
|
|
|
|
|
Hi Tr@V,
This is great mate and I appreciate your help so much.
I am thinking of going for either ARDUINO MEGA/ARDUINO 2560
which have ATMEL 1280 and ATMEL 2560 chips respecetively.I will probably have to connect a bluetooth or wifi shield and a SD card for storing.Am not much aware of Freescale Kinetis family of MPU's you suggested but will check them out.
Any chance I can get your email address or phone number incase i hit hard rocks?I may need your help.I'll also let you know how far have gone.
Thanks.
|
|
|
|
|
I have made some good progress with my ISR and am serial printing the count on the serial monitor, now what I want to achieve is to call the count to be displayed on my 3 digit seven seg cc display or rather let the ISR trigger the counts whenever the sensors flag depending on their sequence. I have the code to count from 0-999 back to 0 so my problem is how to combine with the ISR. Any help is much appreciated.
Much thanks.
|
|
|
|
|
Kindly gurus,
Assist me in the below questions. I am new in C++ and even don't know where to start. Please somebody help me out
Write a program using functions that prompts for the input of social security numbers upto a maximum of 10. Store the social security numbers in a two dimensional array of characters. Ask if the array of social security numbers is to be sorted in ascending or descending order, then call a bubble sort function that you write to sort the array. The program should print the unsorted list first, sort the list, then print the sorted list. The bubble sort algorithm is as follows:
A. Start with the first two array elements.
B. Compare the elements and exchange them if the
compare function indicates they should be swapped.
C. Bump up one element and repeat step B.
D. Continue until the end of the array is reached.
E. Repeat steps B -> D decreasing the upperlimit on
the array by one for each iteration of the loop.
In other words, stop one element short of the
previous iteration in the main loop.
F. End the sort if:
1. No exchanges occur during an iteration or
2. The upper limit for the loop reaches one.
|
|
|
|