|
Ryan Binns wrote:
For actually writing the data, I'm not sure that there is much difference between the functions.
There really is no difference. In the long run they all call the WIN32 api calls WriteFile(), OpenFile()... These functions operate on the file cache. If you are worryied about cpu cycles this is not really a problem because the disk is orders of magnitude slower than the cpu or memory so your choice does not make much difference.
John
|
|
|
|
|
Hello,
I posted a question a while back about going from Windows 2000 to XP and getting dll errors. I've come to the conclusion that the project was written in version 7.0 while I have version 7.1 of Visual Studio. Yes, turning the porject to a non-debug version will solve the missing dll errors (because the dll's are associated with the debug library). However, I wish to work with the projects in debug form. Is there a way to guarantee that all my projects are on the same version? Does .Net install a different core version depending on the install type you choose? Thanks.
|
|
|
|
|
Hello friends,
i am having a small query for all of us. i am having a Wizard sheet - 97 based application. Now i am having a banner i.e the header bitmap on the property sheet changes it color to black and white or it looses the proper color display if the windows display setting is set to 256 color. the bitmap is loosing the resolution can any one help me to initialise my own palette or bursh with help of which the bitmap can be drawn. if any one has dones such thing please do help me.
Thanx
TAKE CARE
|
|
|
|
|
I was just wondering if anyone knows how to quickly calculate very large exponents. I am playing around with some RSA encryption, but calculating a number raised to some 30 digit number takes a long time (in fact, I still have yet to see it finish). I've also looked a bit for the code that does the Pow() function, but I can't find it. Anyhow, is there a faster way to do this?
If you have a problem with my spelling, just remember that's not my fault. I (as well as everyone else who learned to spell after 1976) blame it on Robert A. Kolpek for U.S. Patent 4,136,395.
|
|
|
|
|
hi,
the fastet way would be the logarhithmic one. But I fear that during the conversion processes some significant digits might get lost. But I will be good for estimates.
The next approach will be, by using the fact, that the power is cumulative.
e.g.
3 raised to the power of 8 = 3 raised 4 * 3 raised 4 = 3 raised 2*... an so on.
a= 3;
a= a*a (=9)
a= a*a (=81)
a= a*a (=6561)
a= a*a (=43046721)
a= a/3 (=14348907) = 3 raised to the power of 15
Maybe this is a solution for making very large numbers?
Regards
G. Steudtel
|
|
|
|
|
Thank you very much! I think I see how I'll be doing it now!
Selevercin
If you have a problem with my spelling, just remember that's not my fault. I (as well as everyone else who learned to spell after 1976) blame it on Robert A. Kolpek for U.S. Patent 4,136,395.
|
|
|
|
|
Hello,
I'm writing a program and i'm using Excel automation in my program.
I opend an excel document (sample.xls) with Workbooks::Open() function and now i wanna get access to document's cells.
But i don't know how to initial _Workbook object with my current excel document (sample.xls) !
I took a look at MSDN and excel automation samples, and i just found this:
Workbooks books;
_Workbook book;
LPDISPATCH lpDisp;
.
.
.
lpDisp = books.Add( covOptional );
book.AttachDispatch( lpDisp );
In this sample, the programmer first makes a new document and then uses of it.
But i don't want to do it and i just want to get handle of opened document.
Regards,
Hadi
|
|
|
|
|
Try the following code to work with an existing Excel file.
Hope that's what you need.
_Application m_app;
Workbooks m_workbooks;
_Workbook m_workbook;
Worksheets m_worksheets;
_Worksheet m_worksheet;
COleVariant VOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
COleVariant covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
COleVariant covTrue((short)TRUE);
COleVariant covFalse((short)FALSE);
m_app.CreateDispatch("Excel.Application");
m_workbooks = m_app.GetWorkbooks();
m_workbook= m_workbooks.Open("path_To_Your_Excel_File",
VOptional, covTrue, VOptional, VOptional, VOptional,
VOptional, VOptional, VOptional, VOptional, VOptional,
VOptional, VOptional );
//Make Excel visible if you like
m_app.SetVisible(TRUE);
m_worksheets=m_workbook.GetWorksheets();
//Choose the sheet you want to work with
for(int i=1;im_worksheets.GetCount()+1;i++)
{
m_worksheet = m_worksheets.GetItem(COleVariant((short) i));
sheetName=m_worksheet.GetName();
if(sheetName=="name_of_a_sheet_in_your_excel_file")
{
break;
}
}
MS
|
|
|
|
|
Hi dear Manfred
Thanks alot for reply, it was exactly what i needed.
Best Regards,
Hadi
|
|
|
|
|
I'm developing an application which supports Speech Recognition,
in this application I want to add one button which opens the
training wizard for the Microsoft Speech Recognition, and one
button opening the Speech Properties Dialog,
can anyone tell me how this can be done?
|
|
|
|
|
If you can trace the excutable that launches the dialog, you can use ShellExecute().
hope this helps
|
|
|
|
|
Thanks!
Looked at it and it was rather easy.
To open the control panel it's just the "Control.exe" file
and to open the Speech Properties I used "Control.exe speech"
|
|
|
|
|
Hello all,
I want to open an IE window...that I have done..but i dont want any other window to be opened..after this one..I have trapped all functions to open the new window using keyboard and mouse hooks..but as i cannot disable mouse leftclick..so there is a probability that i can click on any link and if that links opens in new window..then new window will open..can anyone suggest what i need to do...any help, pointers or ideas are highly appreciated..Thanks a lot in advance..
Himanshu
|
|
|
|
|
I don't know if it will work but it might help!
Let's get some things straigt first:
If you open a link in a new window, it's not a child window, since the fact that when you close the first Iexplorer, the others are not closed.
based upon this, you can install a hook on the Iexplorer (I don't know which one, but any may do). In shared memmory or a disk file you can count how many Iexplorers are opened! if the number exceeds 1 you can post a WM_QUIT message or do anything brutal to close the window.
hope this helps .
|
|
|
|
|
Hi,
I posted this last week, and tried to work on this over the weekend but with no success. This is something that i can't seem to figure out. Can someone tell me how to do this exactly? I never really coded before and this is causing me much headaches.
This was the suggestion that I received from G.Steudtel:
Try to get the applications pointer of its CMainCommand instance, and use this pointer.
Or send/post the command to the application as if the user has selected the dialog via the menu.
Here is what I posted:
I have a modeless window and a modal window, each having their own window option that when selected bring up the corresonding window. The modal window has radio buttons on it, so when a specific reaio button is selected and ok is entered, it will display the modless window.
When I select the menu to bring up the modeless window it works fine, only opens one window or sets focus to it if it has not been created. When I select the modal window and check the appropriate radio it will display the modeless window regardless if it is created already. It will just continue to duplicate the modeless window.
Can someone help me out so that it will set focus on the open window and not diplicate it.
currently I am using this code in the OnOK method.
if (!m_pCommandOpt)
{
m_pCommandOpt = new CMainCommand(this);
if (m_pCommandOpt->Create(IDD_MAIN_TAB_DIALOG) == TRUE)
{
GetDlgItem(IDOK)->EnableWindow(FALSE);
m_pCommandOpt->ShowWindow(SW_SHOW);
}
}
else m_pCommandOpt->SetActiveWindow();
THANKS in advance.
|
|
|
|
|
Are you using the same pointer in your dialog class as you are when you use the menu? Yes, I know it's a silly question, but I can't really think of any other reason why it wouldn't work.
The other thing you could try is to send a WM_COMMAND message corresponding to your menu item, so that all the window stuff is done in the same place. That would probably simplify things. I think this was mentioned before, but it's what I would do, so I'll mention it again
Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I am not using the same pointer....I don't know how to get the two classes to communicate with each other. Could you please show me how to get one pointer from one class to another one? I tried to do this, but was couldn't get the code to compile correctly.
How would I do the option you mention about the WM_COMMAND? I do not totally understand what you mean by this.
THANKS FOR YOUR HELP.
|
|
|
|
|
Jay Hova wrote:
How would I do the option you mention about the WM_COMMAND? I do not totally understand what you mean by this.
Say your menu item was ID_SHOWDIALOG (for example). You would send a message to your frame window exactly the same as what Windows does when a menu option is chosen.
AfxGetMainWnd()->PostMessage(WM_COMMAND, ID_SHOWDIALOG, NULL); Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I'm sorry for being so slow with this, but what does this exactly do. How will this solve my problem? Also where would i put this code. The code that I posted originally is the same code I use for both menu items...
Thanks again for your help and understanding
|
|
|
|
|
Ok. Basically, using that piece of code will simulate in software exactly what happens when the user selects a menu item. You would put this code where you handle the radio button being pressed, so that pressing the radio button behaves the same as selecting a menu item. This means that the code to actually display the dialog would only be in one place, and should solve your problem.
Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Many thanks Ryan. You just solved my problem that I have spent way too many hours on.
Worked like a charm.
|
|
|
|
|
You're welcome
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi,
I feel sorry for my short and as I thought understandable answer. I didnot know, that you never coded before. So let me dig a little deeper with this answer.
In your main application class you should have a pointer to or an instance of class CMainCommand. This pointer or instance must be used by all calls to open the dialogs.
Have a look at the headerfile of your application class to find out, wheter the CMainCommand thing is private/protected or public.
In the application headerfile add a member function:
<br />
CMainCommand* GetCommandPointer(void);<br />
Assuming it is a pointer (lets call it pMainCommand) write in the applications cpp-file
<br />
CMainCommand* CWinApp::GetCommandPointer(void)<br />
{ return pMainCommand;}<br />
Of course you have to substitute CWinApp and pMainCommand with the names of the actual class name and variable name. If you do not use a pointer, but an instance of the class replace pMainCommand with &mainCommand;
In your OnOk handler write
<br />
m_pCommantOpt = DYNAMIC_DOWNCAST(CWinApp,AfxGetApp())->GetCommandPointer();<br />
Here too you have to substitute the CWinApp with the actual name of your application class. Also you have to include the applications header file into your cpp file. (But this should be done already by class wizard)
This line above does:
It retrieves a pointer to the application class instance, casts it to your application class and after the casting calls GetCommandPointer.
Then delete the line where you create an new instance of CMainCommand, bailing out, when the pointer is inavlid and tell the user that someting went wrong.
<br />
m_pCommantOpt = DYNAMIC_DOWNCAST(CWinApp,AfxGetApp())->GetCommandPointer();<br />
if( m_pCommandOpt != NULL )<br />
{ m_pCommandOpt = new CMainCommand(this);<br />
if( m_pCommandOpt->Create(IDD_MAIN_TAB_DIALOG) == TRUE )<br />
{ GetDlgItem(IDOK)->EnableWindow(FALSE);<br />
m_pCommandOpt->ShowWindow(SW_SHOW);<br />
}<br />
else<br />
{ m_pCommandOpt->SetActiveWindow(); <br />
}<br />
}<br />
else<br />
AfxMessagebox("Something went wrong");<br />
Regards
G.Steudtel
|
|
|
|
|
Thanks for all the help. I finally got it and it works just like you said it would. THANKS AGAIN!
|
|
|
|
|
Hello, I have a problem now. I want to disable cd rom autoplay function. Because i didn't want to autoplay in my program. I can't do it? May be it need modify register table. Can you help me? I wish you. Waiting online...
|
|
|
|