|
Hi,
This is what i'm doing, in VS .net 2003:
1. Create an SDI application.
2. Add a dialog to resource named IDD_DIALOG1 and make the Style as Child.
3. Add a Dialog class from that resource, say CDlgTest .
4. Add a member variable, say m_dlgTest to the View class of the application.
5. In the WM_CREATE message handler of the view class, I add the following two lines,
m_dlgTest.Create( IDD_DIALOG1, this );
m_dlgTest.ShowWindow( SW_SHOW );
The dialog window which shows up is never painted as activated. In my application, I'm having several such windows, so there is no way for the user to know which window is he working upon?
Please help.
Thanks in advance.
"Do first things first, and second things not at all."
— Peter Drucker.
|
|
|
|
|
Does anybody know where I can find information on the
IImageDecodeEventSink and the IImageDecodeFilter interfaces that are declared in ocmm.h ?
Best regards
Carsten
|
|
|
|
|
I am developing an application which explicitly loads a .dll (using LoadLibrary) and ideally I would like to access a static class member in the loading .exe from code in the dll.
The static member appears to be there, but is at a different address and is uninitialised.
Directly accessing the static data from within the .dll causes an exception.
It looks like the problem is the address space that the .exe and the .dll occupy - I'm presuming that it's the same if the .dll is implicitly load, but not if explicitly loaded
is there any way of calling from the .dll back into the .exe ?
any help appreciated
|
|
|
|
|
DaveDrPop wrote: is there any way of calling from the .dll back into the .exe ?
have the EXE give the DLL a pointer to a callback function in the EXE that the DLL can call whenever it wants. ex.
in the DLL:
typedef double (CALLBACK* MyCALLBACKPTR)(int param1, int param2);
MyCALLBACKPTR globalCallback = NULL;
void SetDLLCallback(MyCALLBACKPTR p)
{
globalCallback = p;
}
...
if (globalCallback!=NULL)
{
double v = *(globalCallback)(a,b);
}
in the EXE:
double CALLBACK foo(int a, int b)
{
return 3.14156;
}
SetDLLCallback(foo);
the parameters on the callback function are completely up to you, of course.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
How to detect wether USB drive is writable or not!I have tried CreatFile and GetLastError with the value of ERROR_ACCESS_DENIED.But creating a dummy file is not friendly gesture. Is there other ways around?
|
|
|
|
|
Create a HANDLE to the drive, then use this code:
BOOL IsDiskWriteProtected(HANDLE hDrive)
{
DWORD dwRet;
BOOL bWritable = DeviceIoControl(hDrive,
IOCTL_DISK_IS_WRITABLE,
NULL, 0, NULL, 0,
&dwRet,
NULL);
// If you don't have the SDK, IOCTL_DISK_IS_WRITABLE is a DWORD
// with the hex value 0x00070024
if(bWritable == TRUE) return FALSE;
return TRUE;
}
To get a HANDLE to the drive, do this:
BOOL OpenDrive(char drive)
{
char NtDriveName[10];
char m_drive = drive;
if(hDrive != (HANDLE) 0) CloseDrive();
// Open and Lock the drive
//
m_drive = (char) toupper((int) m_drive);
sprintf(NtDriveName, "\\\\.\\%c:", m_drive);
hDrive = CreateFile(
NtDriveName,
GENERIC_READ | GENERIC_WRITE, // Possibly just GENERIC_READ
0,
NULL,
OPEN_EXISTING,
FILE_FLAG_NO_BUFFERING,
NULL
);
if ( hDrive == INVALID_HANDLE_VALUE ) {
// Cannot open it, Error!
return FALSE;
}
// OK
return TRUE;
}
-- modified at 7:13 Wednesday 26th October, 2005
|
|
|
|
|
Thanks kakan!
The code finally turned into
CString strDrive;
strDrive.Format("\\\\.\\%c:", 'C');
HANDLE hDrive = CreateFile(strDrive, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL);
DWORD dwRet;
BOOL bWritable = DeviceIoControl(hDrive, IOCTL_DISK_IS_WRITABLE, NULL, 0, NULL, 0,
&dwRet, NULL);
But the question is I have "C;D;E;F;G(CDROM)" drives, if I don't specify dwDesiredAccess as GENERIC_READ | GENERIC_WRITE, the returned hDrive for "C;D;E" is INVALID_HANDLE_VALUE, and all the accessable drives' hDrive(valid) is the same(0x000006f8). Is this normal?
|
|
|
|
|
and all the accessable drives' hDrive(valid) is the same(0x000006f8). Is this normal?
A handle's value is an opaque value to your program. It would only be ABNORMAL if you have OPENED more than a single drive simultaneously. If you are opening one drive at a time and then closing the handle, it would not be uncharacteristic for windows to recycle the handle value to you for each drive. If you opened two separate files or drives and got the same handle value back for both while they were BOTH opened, I would be concerned.
|
|
|
|
|
Hello LiYS.
Your second question is already answered, so I will try to answer yor first question.
To be honest, I'm not 100% sure, but my guess is that it isn't possible to open a CDROM-drive in GENEREIC_WRITE-mode.
In my own code, I first try to open the drive in GENERIC_READ | GENERIC_WRITE-mode. If it doesnt work, I try again, in GENERIC_READ-mode.
It seems to work at all times. But of course, if it's possible only to open the drive in GENERIC_READ-mode, then it's obviously read-only.
A comment: You should check your handle for INVALID_HANDLE_VALUE before calling DeviceIoControl.
kakan
|
|
|
|
|
Hi Kakan do you know how to make this code works under Win98?
|
|
|
|
|
Hi community,
how can i set a Textcolor in a CListCtrl for each Item?
In addiction from an Itemvalue i want to set a different Item's Textcolor!
Any Idea?
thanx
break;
|
|
|
|
|
Use NM_CUSTOMDRAW. Sample for this code will be like this
void MyDlg::OnCustomdrawList ( NMHDR* pNMHDR, LRESULT* pResult )
{
NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( pNMHDR );
*pResult = 0;
if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
{
*pResult = CDRF_NOTIFYITEMDRAW;
}
else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
{
*pResult = CDRF_NOTIFYSUBITEMDRAW;
}
else if ( (CDDS_ITEMPREPAINT | CDDS_SUBITEM) == pLVCD->nmcd.dwDrawStage )
{
COLORREF crText, crBkgnd;
crText = RGB(0,255,100);
crBkgnd = RGB(255,32,11);
pLVCD->clrText = crText;
pLVCD->clrTextBk = crBkgnd;
*pResult = CDRF_DODEFAULT;
}
}
|
|
|
|
|
Hi,
thanx, i it helps!
regards
break;
|
|
|
|
|
every wav file have it's own format described by the WAVEFORMATEX struct,I want to get a copy of a wav file with changing it's WAVEFORMATEX .So what can I do?
|
|
|
|
|
Pass the data through the audio compression manager to change its format for you.
|
|
|
|
|
I'm using a class derived from CHtmlView as listview in an internal Folder
Browser of my application.
Exist a facility to hide the left blue task pane (if user have activate this
feature in Folder Options)?
Another fine feature will be, to set the "list" as active default view in my
application (may be the user has set "icon" as default). Any idea?
Thx for help
|
|
|
|
|
What is density sampling?
How can it be used in image resizing?
Pls help
|
|
|
|
|
Write a program in c language to print prime number using recursion
rajesh
|
|
|
|
|
//it will print the no which r prime no and greater than 9
void divisiblity(int divident,int divisor);
main()
{
const int divisor=9;//keep it const
int divident=10;
while(1)
{
divisibility(divident,divisor);
divident++;
}
}
void divisibility(int divident,int divisor)
{
if(divisor==1)
{
printf("the no is a prime no\t%d",divident)
return ;
}
int remainder=divident%divisor;
if(remainder==0)
return;
divisibility(divident,divisor-1);
return;
}
hope this may help u
-- modified at 6:43 Wednesday 26th October, 2005
|
|
|
|
|
you suck !!
do your homework by yourself.
assignments are made to make you progress ; asking someone to do it for you will never deserves you.
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Rajesh_K_Sharma wrote: Write a program in c language to print prime number using recursion
Anything else ?
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
|
|
|
|
|
a beer please... that's very URGENT !!!!!!!
cheers,
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
BEER are not allowed in public places ;P
"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
|
|
|
|
|
ThatsAlok wrote: BEER are not allowed in public places
even non alcoholized ones ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
toxcct wrote: even non alcoholized ones ?
Yeap
"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
|
|
|
|