|
Could be because you haven't read the guidelines.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hello all,
As you all probably know I am very new to programming. I am trying to understand the terminology involved with programming. So if you all do not mind, lets use the following example as I try and explain it. Please refer to the following link:
http://msdn.microsoft.com/en-us/library/aa446675(VS.85).aspx[LINK]
GetUserObjectSecurity is a function. Its function is a member of what?
does GetUserObjectSecurity have to be included in int main() ? If not can you please explain the reasoning?
If you look at the link I provided above, on the page it has a syntax block. In the syntax block, it is refering to BOOL. Now I have seen bool and BOOL and was wondering if this is included in your source code? I read that BOOL is the older version of bool? And all bool is for, is for true/false correct?
I also read that bool is a type of int, meaning could you use bool main() ? Obviously I am confused on this. Also when you use bool, is it required to be typed out in your source, or is it implied by some <header> file? How do you properly use bool? I also read that bool uses one (byte), versus BOOL uses 32(bits). Why is this?
When using GetUserObjectSecurity, what are the usages of the parameters? Can anyone provide an example with an explanation?
Thank you all so very much for your time and effort in helping me learn C++ and to continue my academic future.
V/R
Rob
|
|
|
|
|
rbwest86 wrote: GetUserObjectSecurity is a function. Its function is a member of what?
I don't quite get this. If you're asking "where" is this function located, then I would say it is within a DLL named User32.dll , and comes with a companion lib file named User32.lib (The prototype is defined in Winuser.h , which is in turn included by Windows.h ). So when you link to User32.lib , you could use the function like using a function that is within your code.
rbwest86 wrote: does GetUserObjectSecurity have to be included in int main()
You don't "include" a function, you call it. You can call this function, wherever you want to, given that you've included the relevant header file and linked to the relevant library, discussed above.
rbwest86 wrote: I read that BOOL is the older version of bool? And all bool is for, is for true/false correct?
BOOL is actually int , defined like this: typedef int BOOL; (I'm not sure about the file, just right click and select go to definition.) Also, Google for "BOOL vs bool".
rbwest86 wrote: Is BOOL older version of bool?
No.
rbwest86 wrote: And all bool is for, is for true/false correct?
Yes.
rbwest86 wrote: I also read that bool uses one (byte), versus BOOL uses 32(bits). Why is this?
BOOL uses 32 bits because it *is* an integer (discussed above). bool is limited to work with true and false . But with BOOL , you could use any integer. And this can come handy, if you're returning BOOL from a function and you could:
* return -1 to indicate that the function failed
* return 1 to indicate that the function succeeded
* return 5 to indicate that the something went wrong, but the error was handled. (A file wasn't existing, but it was created and written into)
* etc.,
rbwest86 wrote: Also when you use bool, is it required to be typed out in your source, or is it implied by some file? How do you properly use bool?
bool is an in-built datatype. You do not have to include any headerfile to use it. However, to use BOOL , you may have to include the headerfile, which defines it (right click on BOOL , select go to definition. That should show you the header file)
rbwest86 wrote: When using GetUserObjectSecurity, what are the usages of the parameters? Can anyone provide an example with an explanation?
The MSDN doc page what you gave us, has an example link for the same function at the bottom. It is here[^]
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
HI,
can any body help me as i m trying to make a resource dll to provide multilingual support for my application, is it possible to create resource file with only string tables for different languages without adding dialog boxes to it.
Thanks in Advance
Varun Bhatt
|
|
|
|
|
And why do you think it is not possible?
To create a resource only DLL check out this link.
Creating a Resource-Only DLL[^]
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
I have a dialog based application named: basicreport
and created
one dialog called: CExternalDataDlg ,
3 property page called: CImportPage, COptionPage, CConfirmPage
and 1 property sheet named: CImportPropertySheet.
inside: BOOL CBasicReportApp::InitInstance()
BOOL CBasicReportApp::InitInstance(){
......
CExternalDataDlg dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
return FALSE;
}
CExternalDataDlg displayed correctly, worked fine!
I have change above code to:
BOOL CBasicReportApp::InitInstance(){
......
CImportPropertySheet importWizardSheet(_T("Import Spreadsheet Wizard"));
CImportPage importpage;
COptionPage optionpage;
CConfirmPage confirmpage;
importWizardSheet.AddPage(&importpage);
importWizardSheet.AddPage(&optionpage);
importWizardSheet.AddPage(&confirmpage);
importWizardSheet.SetWizardMode();
m_pMainWnd = &importWizardSheet;
INT_PTR nWizardResponse = importWizardSheet.DoModal();
if(nWizardResponse == ID_WIZFINISH){
AfxMessageBox(_T("Importing..........."));
}
else if(nWizardResponse == IDCANCEL){
AfxMessageBox(_T("Cancel"));
}
else{
}
return FALSE;
}
CImportPropertySheet displayed correctly, worked fine!
but when i combinated the both above into once. It looked like
CExternalDataDlg dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
CImportPropertySheet importWizardSheet(_T("Import Spreadsheet Wizard"));
CImportPage importpage;
COptionPage optionpage;
CConfirmPage confirmpage;
importWizardSheet.AddPage(&importpage);
importWizardSheet.AddPage(&optionpage);
importWizardSheet.AddPage(&confirmpage);
importWizardSheet.SetWizardMode();
INT_PTR nWizardResponse = importWizardSheet.DoModal();
if(nWizardResponse == ID_WIZFINISH){
AfxMessageBox(_T("Importing..........."));
}
else if(nWizardResponse == IDCANCEL){
AfxMessageBox(_T("Cancel"));
}
else{
}
}
else if (nResponse == IDCANCEL)
{
return FALSE;
}
return FALSE;
The ExternalDataDlg displayed, when i press OK button on ExternalDataDlg the CImportPropertySheet blink and the immediately disappear without any action by user.
i dont know why? Please kindly advise
modified on Saturday, April 11, 2009 9:16 AM
|
|
|
|
|
Image *pIm = bm.GetThumbnailImage(size.Width, size.Height);
ImageType imt = pIm->;GetType();
Bitmap *pBm = dynamic_cast<bitmap>(pIm);</bitmap>
I need an HBITMAP object, so I need a Bitmap first.
In this code, imt will be ImageTypeBitmap ,
but pBm will be NULL . What is the problem?
Though Graphcs::DrawImage can do the work, but it's better
to save a Graphcs object.
|
|
|
|
|
Hello,
Right now I am facing a program to program the program I'm willing to use in my project.I am using a at89s52 micro controller to trip a few relays as per my convenience. but the problem i am facing is to program my microcontroller i.e., in writing the source code for my micro controller...
hope I got the response..
vikram singh
|
|
|
|
|
|
hi ı have got a project name sudoku. ıhave already write c code but something wrong ı couldn't find it .please help me !!!
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<time.h>
#define size 9
#define size2 81
int checkingSquare( int *i,int *j,int *row,int *column,int **a);
int main(){
int i,j,row,column,controller=0;
int **a=0;
srand(time(NULL));
for(i=1;i<10;i++)
{//start for1
for(j=1;j<10;j++)
{//start for2
while(controller==0)
{ printf("access1");
controller=checkingSquare(&i,&j,&row,&column,a);
}
}//end for 2
}//end for 1
for(i=1;i<10;i++){
for(j=1;j<10;j++){
printf("%d\n",a[i][j]);}}
return 0;
}
void square(int *inte,int *inte2,int *row,int *column){
*row=*inte/3;
if(*row!=1)
{
*row++;
}
*column=*inte2/3;
if(*column!=1)
{
*column++;
}
}
int checkingSquare( int *i,int *j,int *row,int *column,int **f)
{
int x,y;
* (*(f+*i)+*j)=rand()%9+1;
printf("access");
//checkin big squares
square(i,j,row,column);//to determine which big square we are in
for(x=(*row * 3 -2);x<(*row*3+1);x++)
{
for(y=*column*3-2;y<*column*3+1;y++)
{
if(f[x][y]==f[*i][*j])
return 0;
}
}
//checkin sides
for(x=1;x<10;x++)
{
if(f[x][*j]==f[*i][*j]){
return 0;}
}
for(y=1;y<10;y++)
{
if(f[*i][y]==f[*i][*j]){
return 0;}
}
return 1;
}
|
|
|
|
|
I suggest you help yourself getting helped by making things somewhat easier, such as showing formatted code (use the "code block" button) and by specifying the symptoms, i.e. why do you think something is wrong?
![Smile | :)](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
tayyyar wrote: but something wrong
as per Luc's comments - define 'something' for us - what are the symptoms/error messages - can you step by step debug the program for example
we dont read minds - give us a bit more to go on - no-one (ok, almost no one, unless they are incredibly generous) is going to take code posted in that condition, attempt to compile it etc for you given your description.
'g'
|
|
|
|
|
arrays are zero-based, NOT one-based; so your array loops should be like :
for (x=0;x<9;x++)
This signature was proudly tested on animals.
|
|
|
|
|
tayyyar wrote: ...but something wrong...
Such as?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
ıwas complie many times but the program coming we can say read when ı execute program ısaw the window just
"access1 "
and then stop and givme error .
after that ı have to shutdown the program.
I'm stuck ı have no idea how can ı get rid of that ?
some people say give me spesific ı think this message a little bit specific .
ı have got an appointment my lecturer next week for this program .
I'm still searching to fix that but unfortunately nobody knows .
modified on Saturday, April 11, 2009 12:10 AM
|
|
|
|
|
tayyyar wrote: ıwas complie many times but the program coming we can say read when ı execute program ısaw the window just
"access1 "
and then stop and givme error .
after that ı have to shutdown the program.
I'm stuck ı have no idea how can ı get rid of that ?
some people say give me spesific ı think this message a little bit specific .
Common, ... Can't you try at least to write something understandable ? People asked you to give details about the problem you encountered and you reply that the program stop and "givme error". Which error ? Do we really need to ask 20 questions before we can get a clear description of your problem ?
Anyway, did you consider using your debugger to track the problem ?
|
|
|
|
|
http://img2.imageshack.us/img2/4065/adszpfn.jpg
|
|
|
|
|
You'll have to translate that text. In any case, why do you refuse to use the debugger? Anything short of that and you're just wasting everyone's time, including your own.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
tayyyar wrote: some people say give me spesific ı think this message a little bit specific .
You thought wrong. When you take you car to the shop to have it serviced, do you just hand the keys to the mechanic and say, "It won't run" and expect him to know where to start looking?
tayyyar wrote: ı have got an appointment my lecturer next week for this program .
So why has he not been consulted earlier?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
![Go to Parent](https://www.codeproject.com/App_Themes/CodeProject/Img/arrow-up24.png) I've gone through and formatted your code for easier reading for the sake of everyone else's sanity. Please make proper use of tabs and whitespace. Whitespace is ESPECIALLY needed between operators and after comma's (,) I've also added some comments where I think you've made simple mistakes that probably don't affect the problem you're having but are otherwise problems waiting to happen. Most of the changes are however cosmetic in nature.
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<time.h>
#define size 9 //Don't use #define for your constants. Instead use the const keyword and the desired type of the object you are creating.
#define size2 81
int checkingSquare(int *i, int *j, int *row, int *column, int **a);
int main()
{
int i, j, row, column, controller = 0;
int **a = 0;
srand(time(NULL));
for(i = 1; i < 10; i++)
{
for(j = 1; j < 10; j++)
{
while(controller == 0)
{
printf("access1");
controller = checkingSquare(&i, &j, &row, &column, a);
}
}
}
for(i=1;i<10;i++)
{
for(j=1;j<10;j++)
{
printf("%d\n",a[i][j]);
}
}
return 0;
}
void square(int *inte, int *inte2, int *row, int *column)
{
*row = *inte / 3;
if(*row != 1)
{
*row++;
}
*column=*inte2 / 3;
if(*column != 1)
{
*column++;
}
}
int checkingSquare(int *i, int *j, int *row, int *column, int **f)
{
int x, y;
*(*(f + *i) + *j) = rand() % 9 + 1;
printf("access");
square(i, j, row, column);
for(x = (*row * 3 - 2); x < (*row * 3 + 1); x++)
{
for(y = *column * 3 - 2; y < *column * 3 + 1; y++)
{
if(f[x][y] == f[*i][*j])
{
return 0;
}
}
}
for(x = 1; x < 10; x++)
{
if(f[x][*j] == f[*i][*j])
{
return 0;
}
}
for(y = 1; y < 10; y++)
{
if(f[*i][y] == f[*i][*j])
{
return 0;
}
}
return 1;
}
|
|
|
|
|
Hi Pallini, many thanks in advane. Yes, my stepper motor driver supports serial port communication.
Sahih
|
|
|
|
|
Hi,
sahih wrote: Yes, my stepper motor driver supports serial port communication.
That's fine. Now you should study the driver documentation in order to know what you need to send on the serial line.
Have you such a documentation?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
If this in reference to a previous thread, then you should have continued the conversation right there. You need not (and should not) start a new thread for every message that you post.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
I am able to get my *->DevicePath variable to pass to CreateFile (displayed a bit below) however I am unable to get a proper handle. It seems that no matter which attributes or whatever I change to my CreateFile function, the function ALWAYS returns INVALID_HANDLE_VALUE
\\?\usb#vid_04e6&pid_5116#5&9b0a1df&0&1#{50dd5230-ba8a-11d1-bf5d-0000f805f530}
Is it that I have an improper *->DevicePath name, or is it something with my CreateFile? Or am I missing a step here? Any help would be greatly appreciated!
|
|
|
|
|
Hi Forum
I am new in VC++ and i want to make a application which will recovery deleted file from Pen Drive?Can any one give me tips or source link?Plz hep me for find solution.
Thank's
Mike
|
|
|
|
|