|
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
|
|
|
|
|
I am working with a MDI window, where my child window (viwe) is derived from CFromView. With my windows setting the size of form template is (x = 336, y = 218) (as seen from resource view). But when i am loading the child window it gets some default size, which i am not able trace out. My question is how to stop this defaulting setting and assign the actual size (which is the size the from template) ? Please help me to get the solution.
Sandip
|
|
|
|
|
|
Thanks for the suggestion and the code snippet.
Its working fine.
But how do i get the size of from template, which is associated with my view class?
Best Regards
Sandip
|
|
|
|
|
Hi all,
When i run my MFC application,
if i click in an edit control an
press the "return" button the application
exits.
Why ?
How can i avoid that ?
Thanx in advance,
Desmo16.
|
|
|
|
|
Set edit box style from resource editor as "Want return"
or pEdit->ModifyStyle(0,ES_WANTRETURN);
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
My Blog | Understanding State Patte
|
|
|
|
|
I think this will not work..
try this....
simply overide the OnOK() and do not call CDialog::OnOK()
OnOK(){}
Else give Multiline property to edit box
Dream bigger... Do bigger...Expect smaller
aji
-- modified at 7:14 Wednesday 12th July, 2006
|
|
|
|
|
and OnCancel for Esc
whitesky
|
|
|
|
|
You can also aproach PretranslateMessage function
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
My Blog | Understanding State Patte
|
|
|
|
|
PretranslateMessage
Regards,
FarPointer
Blog:FARPOINTER
|
|
|
|
|
set the Want Return style for the edit control.
if u dont want to ur application when the enter key is pressed,
simply overide the OnOK() funtion in the dialog class. Inside that funtion do not call CDialog::OnOK()..
nave
|
|
|
|
|
forgot to say set the multiline property(ES_MULTILINE) also to the edit box.
nave
|
|
|
|
|
Desmo16 wrote:
Hi all,
When i run my MFC application,
if i click in an edit control an
press the "return" button the application
Also make you Edit Control Multiline!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
You can set Want return to true in property window from editbox
whitesky
|
|
|
|
|
Hai
can any one pls tell what is ShellExecute command ? and when do we use it?
Thanks in advance
|
|
|
|