|
Sort your items before putting them in the COleSafeArray container, or use Excel's automation features to sort the items after they are stored in the xls file. COleSafeArray doesn't have any built-in sorting functionality.
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
|
|
|
|
|
Hello Zac,
thax, that works, sorting before putting in COleSafeArray!
regards
break;
|
|
|
|
|
hi all
how to capture mouse movement over button event. Specifically i need a event when mouse moves over a button and another event when it goes away from that button.
I am doing this in Win32 C based application.
If u have any link to sample code pls specify that.
Thanks
Manjunath S
Bangalore
|
|
|
|
|
have a look at _TrackMouseEvent
|
|
|
|
|
I am using this function, but not getting event when mouse moves over button.
The code i am using is,
TRACKMOUSEEVENT track;
track.cbSize = sizeof(TRACKMOUSEEVENT);
track.dwFlags = TME_HOVER | TME_LEAVE;
track.hwndTrack = bHandle; //handle to the button
track.dwHoverTime = 1000;
_TrackMouseEvent(&track);
And i am checking WM_MOUSEHOVER, WM_MOUSELEAVE messages.
Is it correct. thanks for ur suggestions.
Manjunath S
Bangalore
|
|
|
|
|
|
My program is of SDI . a model dialog should be poped up when it is running,but the dialog poped up only I press the Alt button on the keyboard sometimes,why?how to resolve this problem ?
|
|
|
|
|
You've not provided nearly enough information. For starters, what code do you have in place to create/display the dialog?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Blew is my code:
CELinkConfiguratorView is the view of my SDI application,Online() is the handler message of a menu, CCBrowseOnline is the class of a model dialog.
when click the menu,the the DlgBrowse dialog should be poped up,but it didn't pop up sometimes .but it poped up after I press the Alt button on the keyboard. why?how to resolve this problem?
void CELinkConfiguratorView::OnOnline()
{
// TODO: Add your command handler code here
CELinkConfiguratorDoc* pDoc = GetDocument();
// Open the serial port
if(pDoc->ComportInfo.ubComInterface == 0)
{
CString msg;
if(!m_Port.Open(ComportNur,
ComportBr, Parity,DataBits,StopBits))
{
msg.Format ("*** Error: Can't open com port");
AfxMessageBox(msg);
return;
}
}
CBrowseOnline DlgBrowse;
DlgBrowse.m_BrowseStr = "Start Browse NetWork...";
if(DlgBrowse.DoModal() == IDOK)
{
isCanSendNew = true;
DownDirect = RST_REQ;
}
}
BOOL CBrowseOnline::OnInitDialog()
{
CDialog::OnInitDialog();
// Inial the progress bar
m_ProCheckOnline.SetRange (0, 63);
m_ProCheckOnline.SetStep (1);
m_ProCheckOnline.SetPos (0);
// start timer
SetTimer(1,100,NULL);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CBrowseOnline::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
if(CurrentCtrl == 3) // upload command
{
if(CurrentMacid == 0)
{
str.Format ("Uploading module setting...");
}
else if(CurrentMacid < 63)
str.Format ("Upload Node %d from Scanner",CurrentMacid);
else
str.Format ("Upload completed.");
}
UpdateData(FALSE);
CDialog::OnTimer(nIDEvent);
}
|
|
|
|
|
What if you changed the OnOnline() method to:
void CELinkConfiguratorView::OnOnline()
{
CBrowseOnline DlgBrowse;
DlgBrowse.m_BrowseStr = "Start Browse NetWork...";
if(DlgBrowse.DoModal() == IDOK)
{
isCanSendNew = true;
DownDirect = RST_REQ;
}
} Does the dialog appear now?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi
I have a propertypage.I have two edit controls.For the first edit control it should have a range of 5 to 50 and for the second it should be 60 to 100.Whenever the entered data was not in this range I gave an error message and set the focus using SetFocus().I have done this in the OnApply() also.
The problem is I have entered the data in the first control and even after receiving the error message and the focus was set also,I have neglected that and entered the data in the second control.For that also I did the same.Finally in the OnApply() also after neglecting the error messages , the dialog has closed.
My requirement is the focus should not go and it has to rise indefinitely if it is not in the range unless I click cancel.Is my approach correct?Please give me a solution.
Thanks in advance.
Sandhya
|
|
|
|
|
For starters, do not enable the OK or Apply buttons if either of the edit controls have invalid data. That alone will get rid of most, if not all, of your problems.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi All,
i am calling DeviceIoControl function to Reset the shared drive device
code snippet is as follows
DWORD dwErrCode, dwErrCode1;
HANDLE hDrive = ::CreateFile("\\\\.\\PHYSICALDRIVE0", GENERIC_READ |
GENERIC_WRITE, FILE_SHARE_READ |
FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING, 0,
NULL );
//check the error in getting teh handle
if (hDrive == INVALID_HANDLE_VALUE)
{
dwErrCode = GetLastError();
return 0;
}
DWORD dwBytesReturned = 0;
STORAGE_BUS_RESET_REQUEST sbRR;
sbRR.PathId = 0;
BOOL bRet = DeviceIoControl
(hDrive,
IOCTL_STORAGE_RESET_BUS,
&sbRR, sizeof(IOCTL_STORAGE_RESET_BUS),
NULL, 0, &dwBytesReturned, NULL);
if(bRet == 0)
dwErrCode1 = GetLastError();
CloseHandle(hDrive);
I am working on windows 2003 server, same code works fine on windows 2000
GetLastError gives "Incorrect Function Error"
can anyone help on this,
Thanks,
Tushar.
|
|
|
|
|
I think the fourth parameter to DeviceIOControl() should be sizeof(sbRR) .
Tushar Mahajan wrote: GetLastError gives "Incorrect Function Error"
Could it be that the driver you are trying to reset does not support the specified function?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi,
Thanks for the reply,
But the same code works fine on windows 2000 machine for the same hardware.
Regards,
Tushar
|
|
|
|
|
But does the exact same driver run on both platforms? Chances are that it doesn't, and if that's the case, there could be a slight difference between the two. I'm just grasping at straws here, so my suggestions are somewhat limited.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
Hi Programm3r,
Do you want to create the DSN at runtime? or can you create the DSN on a machine and then use it?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Hi _AnShUmAn_
Thanx for the response.... I want to create a DSN at runtime.
Regards
Programm3r
|
|
|
|
|
See here[^]
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Thanx _AnShUmAn_
I'll check it out..
Regards
Programm3r
|
|
|
|
|
Programm3r wrote: The thing is I want to create a System (or User) DSN...using VC++.
Use SQLConfigDataSource() .
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Thanx David, I'll check it out...
Regards
Programm3r
|
|
|
|
|
David I have tried using that function but I get these error
error C2065: 'SQLConfigDataSource' : undeclared identifier
error C2065: 'ODBC_ADD_SYS_DSN' : undeclared identifier
I have included the following lib's:
- odbc32.lib
- odbccp32.lib
But nothing, what could be wrong?
Thanx
Regards
Programm3r
|
|
|
|
|
You need to #include odbcinst.h and odbccp32.lib
|
|
|
|