|
1) See here.
2) It is cleverly using the menu from Windows' Recycle Bin. When you right-click on a file in the Recycle Bin, notice the context menu that appears. Step through the CRecycleBinDlg::ExecCommand() function to see how a file is "undeleted."
Line 635 gets a PIDL to the Recycle Bin folder. Then line 782 gets the context menu of this PIDL. The loop at line 809 searches for the verb (e.g., undelete). Once found, line 858 executes that verb.
|
|
|
|
|
This must be a silly problem
I add a new .c or .cpp file to my project with its own .h which it includes:
logmsg.c:
...
#include "logmsg.h"
...
I get:
logmsg.cpp(236) : fatal error C1010: unexpected end of file while looking for precompiled header directive
???
|
|
|
|
|
You must either add
#include "stdafx.h"
BEFORE your include, or change the cpp file "Settings" -> "Precompiled Headers" to "Not using precompiled headers".
Cheers,
Andy
|
|
|
|
|
|
Hi...
i am doing a project which makes use of C to create a structure of let's say
struct Data
{
int age;
char gender;
};
when in C, i use sizeof(Data) to pass the value to Visual Basic to write and update the structure, it gives error and after debugging, it bounds to the sizeof() problem as in C++, this sizeof(Data) returns 8 and not 5 while in VB, it gets 5.
Anyone has a solution. i read up the help file and it says cos of trailing and padding. if i change to this
struct Data1
{
char gender;
};
the sizeof(Data) returns me 1.
|
|
|
|
|
The Intel processors are most efficient when accessing data that is located at memory addresses that are a multiple of eight (I think). This is common with many microprocessors.
Visual C++ defaults to locating structure members on 8-byte address boundaries. Each data element of a structure (or class) will be located at next memory address that is a multiple of 8. This can be changed in the project settings under C/C++, Code Generation.
You can also get fine grained control using #pragma directives in your code. This might be a better approach since you could pack your structures passed to VB on 1-byte boundaries and leave all the internal stuff at the default of 8 which is much more efficient.
Here is a sample:
<br />
#pragma pack(push, test)<br />
#pragma pack(1)<br />
struct Five<br />
{<br />
int i;<br />
char c;<br />
};<br />
#pragma pack(pop, test)<br />
<br />
struct Eight<br />
{<br />
int i;<br />
char c;<br />
};<br />
<br />
int main(int argc, char* argv[])<br />
{<br />
Five five;<br />
Eight eight;<br />
cout << sizeof(five) << endl;<br />
cout << sizeof(eight) << endl;<br />
<br />
return 0;<br />
}<br />
Hope that helps.
Brad
|
|
|
|
|
Thanx Brad. it solves my problem...
|
|
|
|
|
Hello,
I have a question on how command line args work with CreateProcess.
Lets say I want to open a specific Word document. I set a string, program, to
program = " \"C:\\Program Files\\Microsoft Office\\Office10\\WINWORD.EXE\" \"C:\\Docs\\Open This File.doc\" ";
Then I do:
<br />
if( !CreateProcess( <br />
NULL
program.GetBuffer(0),
NULL,
NULL,
FALSE,
0,
NULL,
workingDirectory,
&si,
&pi)
) <br />
where working directory is correctly set.
Now, this runs Word fine and opens the doc.
However, I tried to run another file, a game (C&C Generals).
I wanted the game to run with the flags -quickstart -xres 1280 -yres 1040.
So, I set program:
program = " \"C:\\Games\\C&C Generals\\Generals.exe\" \"-quickstart -xres 1280 -yres 1040\" ";
and did the same thing with CreateProcess. But now, the args are ignored.
I tried to fix it and what worked was when I got rid of the quotes around
-quickstart -xres 1280 -yres 1040 and then it worked fine.
If I get rid of the quotes around C:\Docs\Open This File.doc then Word doesnt open the file correctly.
So, here is my question:
When do I need to use quotes around the arguments? Do I only use quotes if the arg is another file and not when they are flags for the executable?
If my question is not clear, please let me know.
Thanx for the help,
-Flack
|
|
|
|
|
Use the quotes to delimit a single argument. Without quotes, spaces delimit arguments. If a single argument has an embedded space, put the whole argument in double quotes.
You needed the quotes for the Word document because the file name had embedded spaces.
For the game, there are actually 5 arguments:
- -quickstart
- -xres
- 1280
- -yres
- 1040
You wrapped all five in one pair of quotes, so this was interpreted by the program as a single argument.
Hope that helps.
Brad
|
|
|
|
|
Hello, everyone!
I think in C/C++ programming, you need to define a variable as
extern but there is no need to define a function as extern. The only
useful qualifier keyword used before a function is "static". And I
think you can use "#include .h" when you want to use other functions
defined in other files.
Am I correct?
regards,
George
|
|
|
|
|
For free functions (C-ctyle functions), static means the function is not visible outside of the compilation unit (normally the .c or .cpp file).
The default is extern which means the function is visible - when an appropriate declaration is provided - outside of the compilation unit.
Brad
|
|
|
|
|
Thanks, Brad buddy!
Can you show me a case when "extern" keyword is a must? I think if we use
"#include .h" method, no extern functions are needed to use.
regards,
George
|
|
|
|
|
extern is never required since it's the default i.e. if you want the function visible outside of the compilation unit specify extern or specify nothing. Both have the same meaning.
Brad
|
|
|
|
|
Thanks, Brad buddy!
George
|
|
|
|
|
In addition to Brad's answer, I would like to show you some interesting example as demonstrated later in this message.
Anyway, I still recommend you getting a good C++ language book.
The example as:
[file main.cpp]
extern void Test();
extern void Test();
int iGlobalNumber;
void main()
{
iGlobalNumber = 2;
Test();
}
-----------------------
[file mod.cpp]
extern int iGlobalNumber;
void Test()
{
iGlobalNumber = 1;
}
-----------------------
[There is no mod.H file]
-----------------------
BuggyMax
|
|
|
|
|
Thanks, BuggyMax buddy!
Why you use "extern void Test();" two times in main.cpp? It makes me puzzled.
regards,
George
|
|
|
|
|
All the extern keyword does is apply external linkage. If there is a function declaration within a block of code (i.e. a function declaration within a function), it will have to use extern to force linkage outside the function scope.
|
|
|
|
|
Thanks, Dangleberry buddy!
But I have removed one of the two "extern void Test();" statements, and the
program still works OK. Can you explain to me why we need two "extern void Test();" statements here?
regards,
George
|
|
|
|
|
how do i create a 3D visualization of a 2 layer structure? ie supppose i wan to have a 2nd layer (on top of a 1st layer) that follows the contours of the 1st layer(not necessarily flat)?
|
|
|
|
|
Hi all
how can i open a dll to read it's scource code?
Thanks
|
|
|
|
|
The short answer is you can't.
DLLs - and other types of Windows executable files like .exe, .scr, .cpl, ocx, and so on - contain machine code that has been compiled from higher level source languages.
With the exception of open source projects, the original source files - which are separate from the DLL - are almost never provided with an application.
Depending on what you're trying to learn, there may be other ways.
The web is an amazing place to find code that demonstrates how to do almost anything. CodeProject and MSDN are great places to start.
Using development tools that come with Visual Studio, the Platform SDK or sites on the web such as SysInternals, it is possible to view the DLL's external interface. From this, you may be able to learn a bit about what the DLL can do, but not how it does it.
Have a look at "OLE-COM Object Viewer" (Platform SDK) or "OLE Viewer" (Visual Studio 6.0. If the DLL implements COM objects, you can view the type library which show you the interfaces, methods, etc.
"Depends" which comes with Visual Studio lets you look at the functions and data exported by a DLL, as well as what other DLLs it depends on.
Process Explorer from SysInternals lets you see what DLLs a running program is using.
Hope that helps.
|
|
|
|
|
You can't get a DLLs source code from the DLL.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I have a need to create a setup wizard application that will have to do a lot of the same things as the initial VS.Net setup screen does, such as check system requirements, install required system files etc.
What type of project would I need to create in VS.Net 2003 to enable this to run directly off the CD-Rom on nearly all windows versions?
Chris.
|
|
|
|
|
I've not ever used it but aren't programs created with VS.NET limited to run only on those machines having the .NET framework?
|
|
|
|
|
I've got a web browser control.
It loads a page.
The page has some javascript.
In particular, one variable, an array is defined there.
I want it.
any ideas on how to get it?
|
|
|
|