|
Rajesh has replied to you how to count the number of times the left button is pressed.
If you want to increase a timer every (eg, 0.1s) but only if the button is down (ehich is how I read your post), then you need to do two things:
1: Set a timer, and handle it. See SetTimer , OnTimer / WM_TIMER for more information.
2: When you're in the timer routine, check if the button is pressed down.
It took a bit of hunting, but you can call GetASyncKeyState with a parameter of VK_LBUTTON to find out whether the button is pressed or not.
I hope one of these interpretations matches up with your needs.
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
The GetASyncKeyState sounds exactly what I'm looking for. My plan is to do a timing test to see how long it takes for each cycle of a loop that checks the mouse key and increments a count. Once I've done that calibration for the PC I'm using, I can then simply use that function to start and stop the counter to give me the time I'm lloking for.
Thanks!
Dave
|
|
|
|
|
Hi all,
i receive this error please help me how can i solve this.
my stdafx.h looks like this.
#if !defined(AFX_STDAFX_H__1EAE1E61_6C55_4340_B919_9DA4E2BE11F0__INCLUDED_)
#define AFX_STDAFX_H__1EAE1E61_6C55_4340_B919_9DA4E2BE11F0__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <atlbase.h>
#include <atlstr.h>
#include <atlapp.h>
extern CAppModule _Module;
#include <shellapi.h>
#include <atlwin.h>
#include <atlframe.h>
#include <atlctrls.h>
#include <atlctrlx.h>
#include <atldlgs.h>
#include <atlcrack.h>
#include <atlcoll.h>
#include <atlddx.h>
#import ".\MSO.DLL" \
rename( "RGB", "MSORGB" )
using namespace Office;
#import ".\VBE6EXT.OLB"
using namespace VBIDE;
#import ".\EXCEL.EXE" \
rename( "DialogBox", "ExcelDialogBox" ) \
rename( "RGB", "ExcelRGB" ) \
rename( "CopyFile", "ExcelCopyFile" ) \
rename( "ReplaceText", "ExcelReplaceText" )
#include <afxext.h>
#include <afxdisp.h>
#include <afxdtctl.h>
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h>
#endif // _AFX_NO_AFXCMN_SUPPORT
#include <afxsock.h>
please help for this
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
One might wonder why you're using WTL AND MFC...but anyway.
You need to put the MFC includes in before the ATL includes - MFC doesn't like Windows.h being included before it is (and ATL does that).
You may also need to add the line
#define _CSTRING_NS
so that WTL can see CString properly.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
|
Sorry - is your app mainly MFC or mainly WTL?
It doesn't really matter, anyway - the code for reading Excel posted in that article is independent of WTL or MFC. WTL is only used to display the results of reading the Excel file - you could re-implement that in MFC very simply.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
its mainly MFC.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
As I said, the Excel reading code is independent of WTL or MFC. The important line is this one:
#import ".\EXCEL.EXE" \
rename( "DialogBox", "ExcelDialogBox" ) \
rename( "RGB", "ExcelRGB" ) \
rename( "CopyFile", "ExcelCopyFile" ) \
rename( "ReplaceText", "ExcelReplaceText" )
That imports the Excel type library into your C++ program, using smart pointers and managed variants and BSTRs.
Look for the string Excel:: in MainDlg.cpp from that article - that shows you the bits of code that are interfacing with Excel.
For example:
Start Excel
Excel::_ApplicationPtr pApplication;
if ( FAILED( pApplication.CreateInstance( _T("Excel.Application") ) ) )
{
Errorf( _T("Failed to initialize Excel::_Application!") );
return;
}
Load an Excel workbook
_variant_t varOption( (long) DISP_E_PARAMNOTFOUND, VT_ERROR );
Excel::_WorkbookPtr pBook = pApplication->Workbooks->Open( dlgFile.m_szFileName, varOption, varOption, varOption, varOption, varOption, varOption, varOption, varOption, varOption, varOption, varOption, varOption );
Get the first worksheet
Excel::_WorksheetPtr pSheet = pBook->Sheets->Item[ 1 ];
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
My 5 for your tolerance.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
In MFC the above can be done by using CListCtrl class.
but how to do the same in win32 ?
Please help.
|
|
|
|
|
There is no easy way. There is no "check" style for a listbox - there's an MFC class which does clever things for you.
Have a look at the code for CCheckListBox, and you'll see it actually does owner draw for the listbox. I can't remember how it stores the check state - either as item data, or an internal map.
So, you'll have to learn how to do owner draw in Win32 (just a case of setting the right styles and responding to a couple of messages) and implement the functionality yourself.
If I were you, I'd grab large sections of the work from CCheckListBox - but you'll still have quite a bit of effort to do.
Good luck!
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
Thanks for the reply Iain.
I think we can use ListControl in place of listbox.
When I am using ListControl on the dialog, the dialog is not becoming visible.
Does anyone have some idea about it ? Can I use ListControl in a win32 application to show the checkbox.
Thanks in advance
|
|
|
|
|
A List View Control[^] with the LVS_REPORT style set and LVS_EX_CHECKBOXES extended style might be what you're after. Also remember, as with all common controls, you must call InitCommonControlsEx[^].
Steve
|
|
|
|
|
nbugalia wrote: When I am using ListControl on the dialog, the dialog is not becoming visible.
Can you elaborate, please?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
i want to read html file usin c++ or vc++ help me please
thanks in advance
|
|
|
|
|
See here[^]
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
The answer to your actual question is:
You do it the same way you'd read any other file: CreateFile, ReadFile, CFile, CFile::Read, etc.
If you mean a file on a webserver somewhere, that's different.
Lookup InternetReadFile, InternetOpenUrl, etc. Read the documentation for those very carefully.
But that will just give you a big bunch of html.
If you want your program to understand the html, that's different again. But "parser" is the right search term to use. There are articles on codeproject that do various amounts of it, it will just depend on how sophisticated you need to be.
If you want to display html to a user, it's easier - look at CHtmlView in MFC.
Good luck,
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
I have a application where data will get stored in SQL 2000 database. Now i have to retrive data from database & store it in the excel file.
I am using VC++ 6.0 version with MFC, SDI & database connectivity through ODBC.
Could any one guide me to achieve this? Kindly let me know if you would need more details to reply to my question.
Thanks in advance.
Regards,
Dipti
|
|
|
|
|
This link might help you.
http://www.codeproject.com/KB/database/simple_odbc.aspx
Being an Indian makes me feel proud.
|
|
|
|
|
Thanks for your reply. I am new to VC++. This example is without MFC. Could you send me details on how to retrive data from SQL & store it in Excel.
Could you guide me on how to go about this?
Regards,
Dipti
|
|
|
|
|
diptipanchal wrote: Could you guide me on how to go about this?
Break the problem down into more manageable parts. Can you extract data from the database (e.g., using CRecordset )? Can you use Excel Automation?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
No, I have neither read data from database nor used excel automation before.
Could you send me some link or literature on the above?
|
|
|
|
|
diptipanchal wrote: Could you send me some link or literature on the above?
I have 2 semi-related articles.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
How do we create a language pack?
Is there any tutorial available ?
Please provide the link.
Thanks
|
|
|
|
|
If you mean for windows? I strongly doubt you can.
If you mean you want to have multiple resources in different languages in your software, well, just go and add them! Just right click to get properties and set the language of your choice.
There are articles on CP about internationalization / internationalisation you can read for more information.
Good luck,
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|