|
You probably need to do more than just literally translate that code, then - the processor context for the x64 will be different (for example, the 64-bit register set is different) than the x86 context. Have a look at this page on x64 calling conventions[^] - that's very different to x86.
Your best bet might be to rewrite the code as a standalone assembly language file that you can assemble with MASM and then link into your application (that's the easiest way to make sure it works, as you have no compiler bits getting in the way) then use that as a working model to attempt to convert into intrinsics.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
|
I'm using VS2008 Team System. How do I add a web reference to my C++ project?
|
|
|
|
|
Google[^] -> here[^]
You can only add a web reference for a C++/CLR project, not an unmanaged C++ project.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
In VS2005, I used to right click and choose "Add Web Reference". In VS2008, that menu is disabled. Any way to enable it?
|
|
|
|
|
That menu is enabled for me in VS2008 when I have a C++/CLR project. If it's not enabled for you in VS2008 for a C++/CLR project, that says to me that your Visual Studio installation is broken.
The reason Add Web Reference no longer works for unmanaged C++ projects in VS2008 is that ATL Server isn't in VS2008[^]. A simple Google[^] would have shown you that.
You can download ATL Server from CodePlex[^] - it's been open sourced. This includes sproxy.exe, which will generate the C++ wrapper code for the web-service.
The other Microsoft alternative is the Windows Web Services[^], which will be released with Windows 7 and available as an update for Windows XP SP2 and later.
An open-source alternative is gSOAP[^].
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
i think the MFC or unmanaged is means .
how can we add in this kind of project
|
|
|
|
|
In MSDN:
Notifies a service that its startup parameters have changed. The hService handle must have the SERVICE_PAUSE_CONTINUE access right.
Does this mean that I don't need to care about the sync problem between the ControlHandler and ServiceMain function?
|
|
|
|
|
maishuiking wrote: Does this mean that I don't need to care about the sync problem between the ControlHandler and ServiceMain function?
I haven't got a fricking clue and, I suspect, neither will most people on this forum without a little more context describing what you're talking about when you maention "the sync problem".
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I want to change the cursor of my mouse when ever i point it on a button or on a static text. Please let me know can that be done???
Thanks in Advance
|
|
|
|
|
subclass the button or the static window and use SetCursor to change the shape of the cursor when the mouse is over the control see WM_MOUSEMOVE message for the same.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
Rather than handling WM_MOUSEMOVE , as suggested by _AnsHUMAN_ 's answer, you probably want to handle WM_SETCURSOR [^]
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi all,
How to change the environment variable(esp. PATH) setting using
C++ code.
|
|
|
|
|
|
#include "stdafx.h"
#include <cstdlib>
int _tmain(int argc, _TCHAR* argv[])
{
std::system("set pathTEST=d:");
std::system("set p");
return 0;
}
|
|
|
|
|
For just the current process, you already have answers.
If you want to change the system environment variable values, see this answer[^].
User environment variables are similar, except that their values live in HKEY_CURRENT_USER\Environment
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I have a console application with no MFC support (I cannot add MFC support due to several reasons). This console executes another process and the new process does a very lengthy operation (I cannot use a thread within the console to do the lengthy operation, as is performed by a third party library that the app links to, which cannot work in console mode). The console app must be notified of the progress of this lengthy operation periodically. Now, when I thought of how to notify the console, I cannot do a PostMessage (there's no window handle), I cannot do a PostThreadMessage (the primary thread does not have a message queue). Therefore, I am considering the following options:
1. Use a named pipe. The console creates the pipe and uses CreateProcess to spawn the other executable, passing the pipe handle while spawning it. The executable write into the pipe and the console reads.
2. Use Overlapped IO
3. Any other suggestions (No, code injection or CreateRemoteThread is not an option that I will consider).
I have the source code of both the applications, but I don't want to do a lot of changes in the console app (thousands of lines, OLD stuff, no docs). However, I'm open to be convinced to do that as well. Thank you!
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Socket communication may become good option for you
Parag Patel
Sr. Software Eng, Varaha Systems
|
|
|
|
|
It looked like a bad option for me, because I will then need to link to the winsock libraries, will have the overhead of sockets, and will need to ensure that the machine will have a loopback adapter. On the contrary, a locally named pipe will execute in kernel mode, the OS has built-in support for it (no additional libraries). So, I had excluded sockets.
Thank you!
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
A mailslot[^]?
That way, the mailslot name is the only hard-coded link between the app calling the third party library and the console app that monitors them - so, it's a highly decoupled design, which is preferable.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks Stuart, that looks interesting. Now, I'll choose one between Named Pipes and mailslots.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Rajesh R Subramanian wrote: The console app must be notified of the progress of this lengthy operation periodically.
Mailslots, sockets and named pipes.... all for a simple integer percentage value? SendMessage returns a value in its LRESULT which can be used in the console application to retrieve small values such as percentage complete.
Something like this:
#include "stdafx.h"
#include <stdio.h>
#include <string.h>
#include <conio.h>
#include <windows.h>
#include <Psapi.h>
#pragma comment(lib, "psapi")
#define WM_PERCENTAGE WM_USER + 1033
BOOL CALLBACK GetPercentageProc(HWND hWnd, LPARAM lParam)
{
int nLen = GetWindowTextLength(hWnd);
TCHAR szTitle[MAX_PATH];
GetWindowText(hWnd, szTitle, MAX_PATH);
if(_tcsstr(szTitle,_T("YourApplicationTitle")))
{
DWORD dwPID;
TCHAR szModule[MAX_PATH];
HMODULE hModule;
DWORD dwNeeded;
GetWindowThreadProcessId(hWnd,&dwPID);
HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,FALSE,dwPID);
if(EnumProcessModules(hProcess,&hModule,sizeof(hModule),&dwNeeded))
{
GetModuleFileNameEx(hProcess,hModule,szModule,sizeof(szModule));
}
else
{
GetProcessImageFileName(hProcess,szModule,sizeof(szModule));
}
TCHAR * p = _tcsrchr(szModule,_T('\\'));
if(0 == _tcscmp(++p,_T("YourExecutable.exe")))
{
LRESULT dwPercent = SendMessage(hWnd,WM_PERCENTAGE,0,0);
DWORD dwP = dwPercent;
}
}
return TRUE;
}
int main()
{
EnumWindows(GetPercentageProc, NULL);
_getch();
return 0;
}
Note that its recommended to use RegisterWindowMessage [^] for IPC although I did not use it in my example.
Best Wishes,
-David Delaune
|
|
|
|
|
Hi David,
Isn't SendMessage going to be blocking? I was looking for something that would be asynchronous. (OK, I can use a thread, but I am just asking). I'll try this as well.
Thank you for your suggestions.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
1) There is some LIB project, with function doing some math, estimating ticks of the function and saving them to file.
2) There is DLL that exports just single function calling the one from LIB
3) There is console application compiled with 2) to invoke the function
4) There is console application compiled with 1) to invoke the function
5) There is some GUI application compiled with 2) to invoke the function
I encounter differences in timings outputed by 5) during the day. It changes from say 2100ms to 1000ms. This morning it run at 1500ms, but this afternoon it runs at 1780ms.
As at the same time 2) runs with exactly the same DLL at 1100ms.
But 4) always runs faster than the rest at say 900ms.
Has anyone encountered such abnormalities. Are they affected at some extent by host project taking the DLL?
Чесноков
|
|
|
|
|
There is an undocumented effect of Earth Nutation's on the Microsoft DLL calls binding time. Such phenomenon was first theorized by the eminent astrologer Pallinus.
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]
|
|
|
|
|