|
Nibu, I have checked some other resources. It seems that using memory alignment will improve performance by others' points.
But I do not know why alignment will make memory reading operation faster. In my case, foo needs to fetch 4 bytes and goo needs to fetch 1 byte. Even if each time, CPU fetch 4 bytes, I think they should be the same performance, right?
Why do you think memory alignment will improve performance? An example?
regards,
George
|
|
|
|
|
George_George wrote: Why do you think memory alignment will improve performance? An example?
Did you go through the article. It has some good explanations.
|
|
|
|
|
hi:
when i am lisetening to Sharing printer the function of FindNextPrinterChangeNotification wii be fails,and GetLastError()
saying "the handle is invalidation" .
if the prinnter is local ,FindNextPrinterChangeNotification will obtain information about the change.
my code is here
h_change_notification = FindFirstPrinterChangeNotification(h_printer,
PRINTER_CHANGE_JOB ,//0,PRINTER_CHANGE_ALL,
0,
&printerNotifyOptions);
if(h_change_notification == INVALID_HANDLE_VALUE)
{
MessageBox( NULL, "FINd FIRST Error", NULL,MB_OK);
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
GetLastError(),
MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL);
MessageBox(NULL,"FindNext Error",lpMsgBuf,MB_OK );
this->m_listeningStatus = LISTENING_OFF;
return FALSE;
}
this->m_listeningStatus = LISTENING_ON;
while(endLoopInd == 0)
{
return_value = WaitForSingleObject( h_change_notification,50);
switch (return_value)
{
case WAIT_OBJECT_0:
return_value = FindNextPrinterChangeNotification(h_change_notification,
&dw_change,
&printerNotifyOptions,
(void **)&printerNotifyInfo);
if(return_value == 0)
{
//error handling
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL);
MessageBox(NULL,"FindNext Error",lpMsgBuf,MB_OK );
this->m_listeningStatus = LISTENING_OFF;
return FALSE;
}
-- modified at 22:28 Tuesday 3rd April, 2007
|
|
|
|
|
|
Maybe use WMI...check out the Win32_BaseBoard WMI class.
There's many articles here on CP about using WMI if you need them.
Mark
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
Can you give me some code? thank you.
|
|
|
|
|
Type in "WMI" in the "Search" box above and click "Go!". You can then narrow the search to just
C++ related articles
Here's a link to one article: Getting Information from WMI in Visual C++[^]
As you can see, WMI coding in C++ gets a bit wordy.
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
You can use the WMI class Win32_MotherboardDevice
|
|
|
|
|
sun_shb wrote: thanks
for WMI you must need how to use com interfaces in vc!
"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
|
|
|
|
|
Hi all,
I'm using C to write a socket program.I want to add in that server program that it will accept only the password from the client if it's "mypassword":
i'm not writing any client program. the client will be the built in linux Telnet program
so the session will be between the server and client as follows
1. telnet 192.11.11.9 password "mypassword".
2.then the server if recieved the password "mypassword" it will connect if not it will close the connection.
I want to know how i can make the server program recognize that the pasword is right or wrong..how i can write it in the server
Thanks
|
|
|
|
|
Hi,
Telnet clients doesn't connect just like that - for telnet connection is special protocol - helping documents:
Telnet protocol: RFC 318
Telnet protocol specification: RFC 854
Telnet options specifications: RFC 855.
-----------
Mila
|
|
|
|
|
You could write an interactive login sequence.
For example your server sends the text line "Enter your authorisation" immediately when a client connects, then evaluate the first newline terminated response from the client. However, this simple approach works with most telnet clients only on a non standard port (other than port TCP 23)... I would strongly recommend to implement the full telnet protocol or at least look for IAC sequences in the server code (RFC 854).
Hope this helps.
|
|
|
|
|
I am using Visual C++ (I know, no duh) Intro ed. I have been lookin at the "Interoperating with Windows Media Player using P/Invoke and C#" B Alex Kent and it told me to use the System.Runtime.InteropServices namespace in my code, but every time i try to use it the compiler tells me it isn't a namespace. I might just be being stupid or something, but could someone help please!
|
|
|
|
|
The System.Runtime.InteropServices namespace is part of the .NET framework so you'll need
to use C++/CLI (managed C++) to use its members.
If you don't want to or can't use .NET then the WMP SDK[^] has info that may be of help.
Mark
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
This is also probably going to sound like a stupid question, but how do i use C++/CLI in my file?
|
|
|
|
|
That's a big topic!
For starters you need VS2003 .Net or better. A switch in the build (compiler) properties for
a project will compile an existing project for the CLR (common language runtime).
From there there's a wealth of stuff to learn and use in the ,net framework. With C++ you can
mix managed/unmanaged code and even compile portions of individual modules to managed or
unmanaged.
Managed C++ adds some stuff including a garbage-collected heap (you don't
need to free managed objects when you're through with them) as well as access to the .NET
framework. Mixing C++ and managed C++ makes it a bit trickier. There's new data types for
managed code too.
That's just what comes to mind immediately. There's literally bookloads of info
Mark
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
I feel kinda silla but could you be more specific about where build properties stuff is cuz i am having trouble finding what your talking about.
|
|
|
|
|
No problem - I'm pretty sure everyone does this stuff for the first time
What version of Visual Studio? Note that in 2003, the managed C++ syntax wasn't formalized so
it uses "managed extensions for C++" syntax. For VS 2005, the managed syntax for C++ is an
official extension to the language (and is different from 2003).
From solution explorer, right-click the project and choose "Properties"
For VS 2003 .NET
Configuration Properties/General/Use Managed Extensions
For VS2005
Configuration Properties/General/Common Language Runtime Support (you'll probably want the "/clr"
setting for an existing unmanaged project).
After a complete rebuild, your app will be a .NET assembly. Instead of CPU machine code, it is
compiled to MSIL. At runtime, it's just-in-time compiled to machine code.
You probably won't notice it, except in the debugger. The first time I tried it on a large
solution with an MFC exe using DirectX, Windows Media, GDI+, etc it built and ran first try, no
problems.
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
Hey thanks for all the help it was useful, unfortunalty I only have MS Visual C++ 6.0 Intro Ed. (although it seems as though i have the .NET framework if i look on the C drive), but i have resources to Visual Studio .NET 2003 so i might try it there. Once again thanks for all your help.
"That's the difference between me and the rest of the world! Happiness isn't good enough for me! I demand euphoria!" -Calvin and Hobbes
|
|
|
|
|
How do i remove a project (.dsp) from the workspace (.dsw) ? The .dsw file says the following
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
Is there a way where I can remove the unwanted project ?
Engineering is the effort !
|
|
|
|
|
Go to ClassView, select the project in the tree, then press Delete.
|
|
|
|
|
act_x wrote: How do i remove a project (.dsp) from the workspace (.dsw) ? The .dsw file says the following
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
Is there a way where I can remove the unwanted project ?
humm.. it just warning!.. if you have confidence go ahead!
"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
|
|
|
|
|
Your best bet is to move to using GDI+, which allows you to specify a transpareny color, and also a level of opacity.
This sort of stuff is a nightmare in GDI. I'd tend to do it by writing my own alphablend that allows me to specify a mask color, and just skip those bits.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hello,
I am looking for a callback function or event (I prefere a callback function) that is called or signaled in case your surface is lost and you are able to restore it. In case of a change of display mode this can easily be done with the message WM_DISPLAYCHANGE. But in case the user presses for example crtl+alt+del (An other application gets exclusive acces to the hardware) then this event is not given.
Thanks
|
|
|
|
|
Hi,
I am using Visual C++ 2005 (no managed C++). Basically, I have a local folder:
c:\local\data
and a remote folder:
\\remote\data
and I want to copy the directories, subdirectories, and the files in them from
c:\local\data
to
\\remote\data
without writing over any existing files. Likewise, I want to then copy the directories, subdirectories, and the files in them from
\\remote\data
to
c:\local\data
without writing over any existing files.
NOTE: The arbitrary remote folder may be defined already as a const char *, but it may not exist yet. The arbitrary local folder, however, would be. All strings come through as const char *'s.
What is the easiest solution without using managed C++?
Thanks!
Raj
-- modified at 15:56 Tuesday 3rd April, 2007
|
|
|
|