|
Have u tried Process Explorer by SysInternals[^]. This will give u the exact module which is using your dll. Then you can kill that module using TaskManager.
|
|
|
|
|
Hello guys,
I have encountered next situation and it would be nice if someone could clarify this :
class Foo
{
public :
int number1;
}Object;
int main()
{
cout<<&Object<<endl;
cout<<&(Object.number1)<<endl;
}
Does this have any eplanation
Why is the address of a class object same as its member variables address;
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
|
|
|
|
|
|
Because number1 is the first member variable.
If you declare a second integer number2 below number1 in the class, its address will be 004575E4.
Best regards
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Giorgi Moniava wrote: Why is the address of a class object same as its member variables address
Why does that confuse you? Where else do you expect the members of a class to be stored?
This is correct behavior. It is simply telling you that the first member of Foo occupies the first memory location in Foo. If you add a member after the first and take it's address, then you will see it is N1 bytes after the first member's address, where N1 is the size of the first member.
|
|
|
|
|
He's obviously new at this. Give him a break.
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I am. I asked a direct question so I can help him better.
|
|
|
|
|
( edited ... to change the subject line which was wrong ... )
(it's been one of those week ... and we're only tuesday ... )
now, I'm confused, is there a better C API than atof , scanf or strtod ? if my input string is not a well formed number ( either plain float number like 2.345 or scientific notation like "1.3e3" ) most of those will work.
double d = atof( "2 3" );
ASSERT( d == 2 );
float f = 0.0;
int iError = sscanf( "2f3", "%f", &f );
ASSERT( iError != EOF );
ASSERT( f == 2 );
char *stopstring;
float f1 = (float)strtod( "2v3", &stopstring );
ASSERT( f1 == 2 );
Is there a all inclusive API that will validate the input ? and give an error when a string that is NOT a valid number is entered.
I know I can do a heck of a lot of pre-validation beforehand on the input string, but it seems that is should be done by an existing API ...
Thanks.
Maximilien Lincourt
Your Head A Splode - Strong Bad
-- modified at 13:49 Tuesday 13th December, 2005
|
|
|
|
|
I don't think so, if you're limited to C only, then you're stuck doing this yourself, or finding some third party library or OS API to do so.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
I use strtod for this. Use the second parameter as an errorcheck.
char *stopstring = NULL;
char *number = "1.23e4";
double Double = strtod(number, &stopstring);
ASSERT (stopstring != number);
ASSERT (*stopstring == NULL);
ASSERT (Double == 12300.0);
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
|
Hi,
How can I display an Open/Save File dialog (using CFileDialog) with the initial directory is 'My Computer'? I tried using SHGetSpecialFolderPath with param CSIDL_DRIVES, but the return string is _T(""), and the CFileDialog object seems not to understand an empty string in m_ofn.lpstrInitialDir. It ususally starts with the current directory.
Please help me do this little thing.
Thanks in advance.
|
|
|
|
|
use SHGetFolderPath instead
From the docs: "This function is a superset of SHGetSpecialFolderPath, included with earlier versions of the Shell. On systems preceeding those including Shell32.dll version 5.0 (Windows Millennium Edition (Windows Me) and Windows 2000), SHGetFolderPath was obtained through SHFolder.dll, distributed with Microsoft Internet Explorer 4.0 and later versions. SHFolder.dll always calls the current platform's version of this function. If that fails, it will try to simulate the appropriate behavior. SHFolder.dll continues to be included for backward compatibility, though the function is now implemented in Shell32.dll."
|
|
|
|
|
Thanks, but it appears that SHGetFolderPath doesn't work with param CSIDL_DRIVES. The return string is empty.
Sincerely,
|
|
|
|
|
what is the return value of SHGetFolderPath?
pszPath
[out] Pointer to a null-terminated string of length MAX_PATH which will receive the path. If an error occurs or S_FALSE is returned, this string will be empty.
Return Value
Returns standard HRESULT codes, including the following:
S_FALSE SHGetFolderPathA only. The CSIDL in nFolder is valid, but the folder does not exist. Note that the failure code is different for the ANSI and Unicode versions of this function.
E_FAIL SHGetFolderPathW only. The CSIDL in nFolder is valid, but the folder does not exist. Note that the failure code is different for the ANSI and Unicode versions of this function.
E_INVALIDARG The CSIDL in nFolder is not valid.
|
|
|
|
|
It returns none of them. It's 0x80070057. This is exactly how I use the function:
TCHAR szMyCompPath[MAX_PATH];<br />
int rc;<br />
rc = SHGetFolderPath(NULL, CSIDL_DRIVES, NULL, 0, szMyCompPath);
Do you have any ideas to set the initial directory of CFileDialog to "My Computer"? This is my ultimate goal.
Thanks in advance.
|
|
|
|
|
That error code means "The Parameter Is Incorrect"
In looking at your code, the second to last parameter is incorrect.
It should be:
dwFlags
[in] Flags to specify which path is to be returned. It is used for cases where the folder associated with a CSIDL may be moved or renamed by the user.
SHGFP_TYPE_CURRENT Return the folder's current path.
SHGFP_TYPE_DEFAULT Return the folder's default path. so change your code to read:
TCHAR szMyCompPath[MAX_PATH];<br />
HRESULT hr;<br />
hr = SHGetFolderPath(NULL, CSIDL_DRIVES, NULL, SHGFP_TYPE_CURRENT, szMyCompPath);
|
|
|
|
|
It doesn't help. Actually SHGFP_TYPE_CURRENT is defined 0.
Did you succeed in retrieving the "My Computer" path? What did the function return?
Sincerely,
|
|
|
|
|
hmm, I get the same results. I think the reason is that CSIDL_DRIVES does not have a real directory path. There must be a way of doing it, but I'm not sure what it is. The closest that I can suggest right now is to use CSIDL_DESKTOPDIRECTORY which does have a real path and it shows "My Computer" as an item in that "directory"
the only other suggestion I have is to hook the open file dialog and find the id of the "My computer" button and click it programmatically.
good luck.
|
|
|
|
|
here's some code that'll do what you want. paste it into a .cpp file and compile and run.
#define _WIN32_WINNT 0x0501
#define STRICT
#include <windows.h>
#include <shlobj.h>
#include <shfolder.h>
#include <tchar.h>
UINT_PTR __stdcall OpenFileHook(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
if (msg == WM_NOTIFY)
{
HWND parent = ::GetParent(hwnd);
HWND tbctl = ::GetDlgItem(parent, ctl1);
LRESULT count = ::SendMessage(tbctl, TB_BUTTONCOUNT, 0, 0);
LRESULT result;
for (int button = 0; button < count; ++button)
{
TCHAR buttonText[1024];
TBBUTTON buttonData;
::ZeroMemory(buttonText, sizeof(buttonText));
::ZeroMemory(&buttonData, sizeof(buttonData));
result = ::SendMessage(tbctl, TB_GETBUTTON, (WPARAM)button, (LPARAM)&buttonData);
result = ::SendMessage(tbctl, TB_GETBUTTONTEXT, (WPARAM)buttonData.idCommand, (LPARAM)buttonText);
if (result != -1 && _tcscmp(_T("My Computer"), buttonText) == 0)
{
if (0 == ::SendMessage(tbctl, TB_ISBUTTONCHECKED, (WPARAM)buttonData.idCommand, 0))
{
RECT rect;
::ZeroMemory(&rect, 0);
::GetClientRect(tbctl, &rect);
::PostMessage(tbctl, WM_LBUTTONDOWN, (WPARAM)MK_LBUTTON, MAKELPARAM(10, (rect.bottom - rect.top)/count * button));
::PostMessage(tbctl, WM_LBUTTONUP, (WPARAM)MK_LBUTTON, MAKELPARAM(10, (rect.bottom - rect.top)/count * button));
}
}
}
}
return (UINT_PTR)FALSE;
}
void main()
{
TCHAR fileBuffer[MAX_PATH * 10];
OPENFILENAME ofn;
ZeroMemory(&ofn, sizeof ofn);
ZeroMemory(fileBuffer, sizeof fileBuffer);
ofn.lStructSize = sizeof ofn;
ofn.lpstrFile = fileBuffer;
ofn.nMaxFile = sizeof(fileBuffer)/sizeof(fileBuffer[0]);
ofn.Flags = OFN_EXPLORER | OFN_ENABLEHOOK;
ofn.lpfnHook = OpenFileHook;
BOOL result = ::GetOpenFileName(&ofn);
}
hope this helps
-- modified at 12:40 Wednesday 14th December, 2005
had to fix the < and >
|
|
|
|
|
Thank you so much. Do we have another way instead of simulating mouse clicks?
Sincerely,
|
|
|
|
|
sorry, i tried, you'll have to take it from here.
|
|
|
|
|
I want to access the Read data from Screen Buffer and copy block data of the Buffer. Is it possible to achieve ? ... I want to read pixels but dont want to use the GDI functions ... Any help on it ?
Best Regards
|
|
|
|
|
Well you could use DirectX for this - I think DirectDraw has functions for something like this.
What are you trying to accomplish?
Do you want to render an image? Manipulate pixels?
If you want to manipulate pixels, you can do so in the WM_PAINT handler, get the HDC, create a new in memory DIB, manipulate the pixels of the DIB, and them bit blit this to your HDC, which will then be displayed on the screen.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
I dont want ti manipulate pixels. I mentioned I dont want to use GDI Functions. Are you sure DirectDraw has functions to read directly from Screen Buffer but is it fast enough ?
|
|
|
|