|
That was my point exactly.
Usually, the CRT functions are an encpasulation of the Win32 API, and since I had already loaded the CRT source code onto my systen, I went and looked at what _access does, and it only relies upon GetFileAttributes, which has nothing to do with determining if a file is open or not.
Your solution with the CreateFile call is closer to what is required.
|
|
|
|
|
He didn't specify the conditions, he just asked a question, and I gave him a possible solution. If you have another suggestion, give it to the OP, not me. I'm not here to argue theory and what-if's.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
See my reply to Blake. Again, I just provided a possible solution. It's up to the OP to pick the best one for his requirements.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Right I get it. But Blake asked questioned how _access could determine if a
file was open or not. I do too. I'm not arguing - I don't know sh*t. I do like to learn new
methods though.
|
|
|
|
|
Hello,
I just wanted to know how to burn Data/Audio CDs with Visual C++ and Windows...
Are there any libraries to accomplish this task?
With best regards,
Ben
|
|
|
|
|
See if the Image Mastering API (IMAPI) is of any help.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
If you need to see a code for write to CD I think we have examples on the codeproject(nero)
|
|
|
|
|
Hello,
How do I initialize a global 2D array in C++?
First, I declared the 2D array outside of the main function.
int data[32][5];
Then in the main function, I initialized the array:
data[32][5] = {{0,0,0,0,0},
{0,0,0,0,1},{0,0,0,1,0},{0,0,0,1,1},{0,0,1,0,0},{0,0,1,0,1},
{0,0,1,1,0}, ......................(rest of the integers here)..........
..................................................................................
{1,1,1,1,1}};
The above is what I typed into visual c++ 2005. After the comma of the first bracket and every 5th bracket, I pressed 'Enter' to go to a new line.
However, when I compiled, there were syntax errors saying that there are missing ; before '{' or '}' .
What is the syntax error?
|
|
|
|
|
Put a backslash at the end of each line. This will have the compiler ignore the backslash and the newline character treating the next line as part of the previous line.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
|
|
|
|
|
Can you not do something like:
int data[32][5] = {{0,0,0,0,0},
{0,0,0,0,1},
{0,0,0,1,0},
{0,0,0,1,1},
...
{0,0,1,0,0},
{0,0,1,0,1},
{0,0,1,1,0},
{1,1,1,1,1}};
void main( void )
{
...
}
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
You can only initialize an array with { } at the point where it is declared.
|
|
|
|
|
My 5 for seeing the obvious where I failed to...
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
|
|
|
|
|
I'm trying ot compile a function that I developed and successfully compiled in Visual c++ 5.0 as well as on Unix. I need to compile it in a 16 bit DOS environment using sockets to interface it with an old Cobol program. I get the error:
error C2065: 'MAKEWORD' : undeclared identifier
on the following code:
#ifdef WIN
WORD wVersionRequested;
int err; // Stuff for WSA functions
WSADATA wsaData; // Stuff for WSA functions
wVersionRequested=MAKEWORD(1,1);
#endif
I have the following includes:
#ifdef WIN
#include <stdio.h> // Needed for printf()
#include <string.h> // Needed for memcpy() and strcpy()
#include <windows.h>
#include <winsock.h>
#include <stdlib.h>
#endif
Any idea why I get this error on code that compiled on other platforms ?
|
|
|
|
|
#include Windef.h<br />
#include Windows.h
jnhemley wrote: I need to compile it in a 16 bit DOS environment using sockets to interface it with an old Cobol program.
I would like to shake your hand. No, really.
/ravi
|
|
|
|
|
Believe me, I didn't know what I was getting myself into when I started this.
|
|
|
|
|
The includes are the following:
include stdio.h
include string.h
include windows.h
include winsock.h
include stdlib.h
I stripped out some of the characters because they didn't print on the forum for my previous message.
|
|
|
|
|
Have you tried the obvious?
search for MAKEWORD in Visual C++ 5.0 documentation? It states it is in windef.h
So if it aint in 1.52 windef.h just add it into some header file
e.g. from Visual C++ 5.0 windef.h
#define MAKEWORD(a, b) ((WORD)(((BYTE)(a)) | ((WORD)((BYTE)(b))) << 8))
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for - in order to get to the job you need to pay for the clothes and the car, and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
|
|
|
|
|
Thanks. The obvious works !
|
|
|
|
|
jnhemley wrote: I'm trying ot compile a function that I developed and successfully compiled in Visual c++ 5.0 as well as on Unix. I need to compile it in a 16 bit DOS environment using sockets to interface it with an old Cobol program.
A bit off topic, but if you are using sockets, then why do you need to write 16 bit code? Sockets is just a stream of bytes, and the recipient Cobol code won't know or care that it was sent the stream from a 16 bit process or a 32 bit process, and your easier-to-write 32 bit code won't care how the reply stream was generated.
Mike
|
|
|
|
|
Hello,
is there any way to loop over the dialog box and set new state of an CCheckBox?
In my example i have an litle dialog with 24 checkboxes + one for all!
Ok, i like when i check this one ,lets say IDC_CHECK_ALL, all other check boxes
should be checked
Its very simple dialog box, 24 + 1 Check boxes and two buttons!
I think on CDialog::NextDlgCtrl() but how to use it and is that the right function for that?
if(IsDialogChecked(IDC_CHECK_ALL))
{
}
thanks in advance
break;
|
|
|
|
|
|
Hello Ravi,
thanks very mutch, i try this!
regards
break;
|
|
|
|
|
My suggestion is that you create a container for your checkbox objects and create them dynamically. You can use std::vector< CCheckBox* > .
This way you can iterate through your container instead of using calls like GetDlgItem and NextDlgCtrl which should be avoided. See here[^] for reasons why.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
|
|
|
|
|
Try setting all of the resource IDs for the checkboxes to be sequential, and then making a loop that iterates through all the ID's.
Write a function that contains the loop and accepts a bool that indicates whether or not you're checking or un-checking the boxes. Using EnumChildWindows will also work, but if the dialog contains more than just checkboxes, you'll be wasting processing time.
There's no reason to over-engineer something like this.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi,
OK, here's the situation: Inherit Code. Shown menu item (an existing form) that needs to have a new control added to it so a user can create a new directory to store their files in. This previously existing form allows me to either cancel or hit OK. No problem. So I naively add an edit control and recompile the code. The form displays and I press cancel(or OK, whatever). Assertion error. So I go looking.
I discover I'm having a problem where the resource files I create are not creating unique identifiers for each control. I've ruled out the logic behind any of the existing code; because all I have to do it add the control to see these errors.
For instance, my resource.h file contains many, many, many entries. Some of the values for the entries have the same numerical constants( See 1016, 1017, & 1018):
<br />
#define IDC_DTC_CNT_LBL 1008<br />
#define IDC_DTC_CNT_VALUE 1009<br />
#define IDC_CRNT_DTC 1010<br />
#define IDC_PNDG_BUTTON 1011<br />
#define IDC_FREEZE_FRAME 1012<br />
#define IDC_Meter 1015<br />
#define IDC_COMBO1 1016<br />
#define IDC_SPECIFIC_CODE_COMBO 1016<br />
#define IDC_TRIGGER_COMBO 1016<br />
#define IDC_COMBO_CATEGORY 1016<br />
#define IDC_CMBO_APPLICATION 1016<br />
#define IDC_COMBO3 1017<br />
#define IDC_COMBO_DOWN 1017<br />
#define IDC_MIN_COMBO 1017<br />
#define IDC_COMBO2 1018<br />
#define IDC_COMBO_APPLICATION 1018<br />
#define IDC_CMBO_CATEGORY 1018<br />
#define IDC_DataList 1019<br />
#define IDC_O2_LIST 1021<br />
#define IDC_BUTTON1 1022<br />
#define IDC_GET_DTC 1022<br />
#define IDC_BTN_ADD 1022<br />
#define IDC_BTN_ITEMCHECK 1022<br />
#define IDC_BUTTON2 1023<br />
#define IDC_BTN_REMOVE 1023<br />
#define IDC_BUTTON3 1024<br />
#define IDC_BTN_REMOVEALL 1024<br />
#define IDC_METER_UP 1026<br />
#define IDC_METER_DOWN 1027<br />
So, the simple answer is to clean it up, right? Not so fast, quick draw. I did that( renumber them start from 100, then starting at 1000 - for their appropriate resource-section.) and now the form isn't even displayed before the assertion errors happen. I click the menu-item and BAM - ASSERTion city.
It seems to me that there are cross-references to other resources in other resource files.
Are there any tools to clean up resource issues like this with VS? Now, here's the kicker: I'm using eVC 4.0 SP4. Yeah, me.
Props to those who reply.
|
|
|
|
|