|
Start working in any project and thinking on how to do it you'll learn a lot.
It's useless to tell you something, because there are not such thing as "super functions",
just classes wich are usefull for certain things.
Anyway I belive CString is the more usefull class in MFC and I always use it, there you have something to begin with.
|
|
|
|
|
thanks ur valuable advise Kharfax
but can u tell me some project for working and tell me about CString as iam beginner to vc++
Ashish Dogra
MCA
Noida
|
|
|
|
|
ashish dogra wrote: but can u tell me...about CString
See here.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
ashish dogra wrote: thanks ur valuable advise Kharfax
but can u tell me some project for working and tell me about CString as iam beginner to vc++
New to VC++ or new to C++ in general? Assuming the latter, you should start with some intro to C++ books. Sams publishing has a "Teach yourself C++ in 21 days" that is decent for getting started. After you have a foundation with C++ to work with, then you will want to check out Petzold's books and Prosise's book.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hi
I am using CSingleLock in a program with a primary thread and a worker thread. On start up or if I do certain operations (both in debug mode) the debuger throws up a Debug Assertion at line 160 in mtex.cpp.
Line 160 shows the floowing
ASSERT(!m_bAcquired);
Does anybody know what the problem is as it’s driving me crazy.
Thanks in advance.
MTM
|
|
|
|
|
mcgmil wrote: Line 160 shows the floowing
ASSERT(!m_bAcquired);
This apparently is not VC++ v6. Correct?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
How are you creating the singlelock? it seems that the syncobject you are using its not valid.
Example:
CCriticalSection g_CS; //global or class member
func()
{
CSingleLock SLock(&g_CS, TRUE);
}
Good luck.
-- modified at 8:50 Wednesday 12th July, 2006
|
|
|
|
|
I am Using Visual C++ Standard 2003
In the document header are the following declarations
CCriticalSection ImageInfoSyncObject;
CSingleLock * pImageInfoLock;
In the constructor of the document .ccp file a new single lock object is created
CDoc::CDoc()
{
pImageInfoLock = new CSingleLock (&ImageInfoSyncObject);
}
Then I use the lock and unlock within a function.
Void CDoc::Function()
{
pImageInfoLock->Lock ();
//Code
.
.
.
.
pImageInfoLock->UnLock ();
}
Has anybody any further ideas as to why I get the Debug Assertion Failure for mtex.ccp line 106
Thanks
MTM
|
|
|
|
|
If i put this code in a function it works perfectly (in VS2005), Try it:
{
CCriticalSection ImageInfoSyncObject;
CSingleLock * pImageInfoLock;
pImageInfoLock = new CSingleLock(&ImageInfoSyncObject);
pImageInfoLock->Lock();
pImageInfoLock->Unlock();
}
|
|
|
|
|
Hi ,
I want my application will be auto UnInstall after specified time.Suppose I want after one year my application automatically uninstall.
I created custome vc++ exe app for Install/unInstall my application.
so what should I do to achieve autoUnInstall.
Please help me
____________
____________
Thanks & Regards
Rajesh k singh
India
|
|
|
|
|
You need to be careful, it should be up to the user when they uninstall as I believe it could be illegal for your application to modify the customers machine in this way, what if the uninstall went wrong and broke the customers machine.
Darka [Xanya]
|
|
|
|
|
raj_all79 wrote: I want my application will be auto UnInstall after specified time.
See here.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
hi
i want write and read one byte on the special address of VGA Ram .
if you have information about it,or you know articles about it
please help me.
|
|
|
|
|
DirectX can lock, read and write to Video memory.
But I can not remomber exact process how to do it.
most of DirectX samples include code u need.
|
|
|
|
|
samira-samehforooghy wrote: i want write and read one byte on the special address of VGA Ram .
This is something we used to back before Windows. Haven't had the need since. What exactly are you trying to do?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Can you be more specific
whitesky
|
|
|
|
|
Hi,
I have two Visual C++/MFC application's in both the application I have the
same structure the structure is as follows
struct lat_lon1 {
char news;
short deg;
short min;
float sec;
}lat;
In one application the size of the structure is 10 and in the other it is 12
In the application which shows the structure size as 10 I am writing the data of the structure using fwrite command
fwrite((struct lat_lon1*) &lat, sizeof(struct lat_lon1), 1, fw);
and creating the same structure I am reading the file using the command
fread((struct lat_lon1*) &lat, sizeof(struct lat_lon1), 1, fw);
but I am unable to read the file.
I saw the settings of both the application's but they appear to be the same
Can anybody please help me in this regard
Pavan P
|
|
|
|
|
size_t fwrite(
const void *buffer,
size_t size,
size_t count,
FILE *stream
);
and you are typecasting to struct lat_lon1* instead of what it should be as marked above in the declaration for the write method . This could be one of the reasons for which you are not able to read the files
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
pavan105nagarbhavi wrote: In one application the size of the structure is 10 and in the other it is 12
Do you have the #pragma pack directive, or are you using the /Zp compiler switch?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
pavan105nagarbhavi wrote: struct lat_lon1 {
char news;
short deg;
short min;
float sec;
}lat;
With the default compiler switches/directives, this structure will be packed as follows:
struct lat_lon1
{
char news;
char junk1;
short deg;
short min;
short junk2;
float sec;
}lat;
That is where you get the sizeof(lat_lon1) == 12 from. Now, with some varying directives (#pragma pack for example), you could get it packed as follows:
struct lat_lon1
{
float sec;
char news;
char junk1;
short deg;
short min;
}lat;
which would give you sizeof(lat_lon1) == 10 . This is a very good example of why it is important to declare variables in a certain order for complex types.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hey everyone. I have a function that reads in a registry value (for
the windows firewall) and one that disables it.
<code>
void wxJobsPanel::DisableWindowsFirewall()
{
HKEY hkeyFirewall;
/*
if ( RegOpenKeyEx(HKEY_LOCAL_MACHINE, registryLocations[0], 0, KEY_ALL_ACCESS, &hkeyFirewall) != ERROR_SUCCESS)
wxLogError("FAILED - Could not open the firewall policy registry entry");
*/
if ( RegCreateKeyEx(
HKEY_LOCAL_MACHINE,
registryLocations[0],
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_WRITE,
NULL,
&hkeyFirewall,
NULL) != ERROR_SUCCESS )
wxLogError("FAILED - Could not open the firewall policy registry entry");
else
{
DWORD value = 0;
if ( RegSetValueEx(hkeyFirewall, "EnableFirewall", 0, REG_DWORD, (LPBYTE) &value, sizeof(DWORD)) != ERROR_SUCCESS )
{
ErrorString("DisableWindowsFirewall()");
wxLogError("FAILED - Could not set the EnableFirewall value");
}
RegCloseKey(hkeyFirewall);
}
}</code>
The error is in RegSetValue. It returns "Access denied". ErrorString
is almost taken completely out of the PlatformSDK which is how Im
getting the error. Ive tried both methods above, using both the RegCreateKeyEx and RegOpenKeyEx. I can open (and read in a different function) with no problem. I can edit the value no problem using regedit. Just this seems to fail and I do not know why.
I've also tried opening the key with KEY_ALL_ACCESS and KEY_SET_VALUE
in combination with KEY_WRITE | KEY_READ.
Any ideas? The user is in the Administrator group. Thanks!
|
|
|
|
|
Why fiddle with the registry at all? Why not just use the INetFwRemoteAdminSettings interface to the firewall in the first place?
[fx:mutters]
honestly, what's the point in having a published API if people are just going to hack the registry anyway....
[fx:off]
Steve S
Developer for hire
|
|
|
|
|
I would have loved to avoid the registry hacking if I could... and I thank you for pointing that out. However, all the examples in the PlatformSDK for the Windows Firewall API are in VB... which doesn't help. Also, Im not the biggest fan of COM and that looks to be what I have to go through... I would rather just have something like the IP Helper API... makes my life easier
Any other suggestions?
Ok, I found this link...
http://msdn.microsoft.com/library/en-us/ics/ics/exercising_the_firewall.asp[^]
And basically followed that to get it working... and it worked like a charm. I wish they would have put the C++ examples in the PSDK but eh... I found it.
Thanks for the direction Steve!
-- modified at 11:32 Wednesday 12th July, 2006
|
|
|
|
|
No problem. I agree with most of your original comment (although I am a fan of COM, DCOM (which is COM with hiking boots on) and COM+, which is something else).
Luckily (?) I can generally read VB and mentally convert to roughly equivalent VC++ code, although it does get messy sometimes. I couldn't remember/find the link myself, or I'd have posted it, but it's that same stuff I read.
The pain for me is that I find myself working on customer sites where they have VC6 and so the platform SDK is fixed at Feb 2003 (or sometimes earlier!), so I often find myself writing wrapper classes to expose stuff like the firewall functionality without needing to include the later PSDK headers or link in the later PSDK import libraries; as for UUID.LIB, just don't ask, all right? Thank BG for __declspec(uuid), that's all I say!
If you hadn't got the link, I'd have snipped a section of source from one of the utilities I wrote which enables the firewall, opens some ports up (for DCOM use) and configures DCOM to use those ports. I'm ashamed to admit it, but that last part does hack the registry, as I haven't found the API to do it 'officially'...
Steve S
Developer for hire
|
|
|
|