|
Call SetTimer in CYourEdit::OnCreate . Kill the timer in CYourEdit::OnDestroy (or alternatively, let the timer be killed by the system upon window destruction).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
Thankyou All that replied on the Timer issue. And thx esp to Nemanja for the link to the timers article.
Mike
|
|
|
|
|
WM_CREATRE and WM_DESTROY are good place
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
I'm stuck. I have MFC-based application, which has in itself CHtmlView. I'd like to have var list in JScript in the current page.
Or maybe somebody know the way to write own JScript debuger?
Thnx in advance,
Sergey
|
|
|
|
|
I am making a regular DLL, and want it to be situated in the windows folder, so each program i make that is installed does not need a seperate copy, but do not know how to do that.
Can someone help?
==================================================
When Your Mind Wonders...Where Does It Go???
|
|
|
|
|
If you're using some installation progfam to do your install package, then there will be means there to indicate that a certain DLL must be located in the system folder.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I seem to remember looking at some code tht had a function to do with registering, so i thought you needed to add some code into the DLL.
==================================================
When Your Mind Wonders...Where Does It Go???
|
|
|
|
|
If you use ATL wizard to write dll,it add those function for you,you only add dll to installshield and check it as selfregister in installshield wizard and installshield do another things for you
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
run this on command:
regsvr32 pathoffile
also if you compile your dll project it is self register and it will register automaticlly
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
Maybe this term 'regular DLL' confused me, but I don't believe he is developing a COM server. Therefore, he does not need to register anything.
I vote pro drink
|
|
|
|
|
Yeah
He simply needs to copy it to the system folder within the windows folder
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
yaep,it seems you're right
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
Hi,
i have a window, simply created with the Win32 API (RegisterWindowEx and CreateWindowEx) no MFC.
I use my own WindowProc (...), and return DefWindowProc to process the messages i don't process myself.... a classic.
I processed the WM_SIZE and WM_MOVE messages up to now without problems, but i have added the processing of the WM_WINDOWPOSCHANGED in my window proc, and i don't receive WM_SIZE and WM_MOVE messages anymore.
Looking at the VC6 docs for WINDOWPOSCHANGED, they briefly say that when DefWindowProc() processes WINDOWPOSCHANGED, it sends the WM_MOVE and WM_SIZE messages to the window.
Then, now i process WINDOWPOSCHANGED myself, that seems to be logic that i don't receive WM_MOVE and WM_SIZE anymore.
Here is my question,
are the WM_MOVE and WM_SIZE messages sent EXCLUSIVELY by DefWindowProc() or does the system(framework) sends these messages to my window too ?
If the system sends them too, could you please tell me when it does so ?
Cheers,
Lion.
|
|
|
|
|
MSDN article Size and Position Messages seems to imply that WM_SIZE and WM_MOVE are only sent from DefWindowProc . Quote:
A window that must process WM_SIZE and WM_MOVE messages must pass WM_WINDOWPOSCHANGED to the DefWindowProc function; otherwise, the system does not send WM_SIZE and WM_MOVE messages to the window.
There could be room for interpretation, but IMHO this paragraph seems to be a little more conclusive with respect to this issue than the documentation on WM_WINDOWPOSCHANGED .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks,
this is exactly what i needed to know because it isn't explicitly writen in my docs.
Lion.
|
|
|
|
|
You are welcome
Please note that the only information I've got with respect to this issue is the one article I sent to you. So you may want to consider taking precautions before jumping to conclusions. It could be a good idea to have on debug mode some assert(FALSE) s on the processing of WM_SIZE and WM_MOVE , so that if this conclusion proves wrong at least you will know.
Regards,
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Well, i placed something in my code that will warn me if i receive one of the two messages but i sincerly doubt about this.
I also found a doc where they specify that a window will not receive any WM_MOVE/SIZE messages if it processes the WM_WINDOWPOSCHANGED and returns 0.
Cheers,
Lion.
|
|
|
|
|
c:\program files\microsoft visual studio\vc98\include\mmsystem.h(113) : error C2146: syntax error :
missing ';' before identifier 'MMVERSION'
c:\program files\microsoft visual studio\vc98\include\mmsystem.h(113) : fatal error C1004: unexpected end of file found
AND HERE ARE THE LINES OF CODES:
/* general data types */
#ifdef _WIN32
typedef UINT MMVERSION;
#else
typedef UINT VERSION
#endif
typedef UINT MMRESULT; #define _MMRESULT_
Does anybody knows what it can be?
|
|
|
|
|
It could be a number of things:- The line
typedef UINT VERSION is wrong: it lacks a terminating ;
#define s must be at the beginning of a line, so instead of
typedef UINT MMRESULT; #define _MMRESULT_ it should be
typedef UINT MMRESULT;
#define _MMRESULT_ - Is
UINT defined (either with a macro or a typedef ) prior to the inclusion of mmsystem.h ? Try issuing a #include <windos.h> first. Hope this helps.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
thanks a lot for the help,
I tried the three solutions but none of them worked.
Do you have an other idea?
I didn't write this file, it's on the visual C++ CDRom...
|
|
|
|
|
I didn't write this file, it's on the visual C++ CDRom...
Hmmm... could you please post the piece of code where mmsystem.h is included? (especially the previous lines to #include <mmsystem.h> ) Thanx
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
#if !defined(AFX_MCI_H_098R22G3234_23453_235124_123A44HQ13451_INCLUDED_)
#define AFX_MCI_H_098R22G3234_23453_235124_123A44HQ13451_INCLUDED_
#include <mmsystem.h>
class CMsf {
public:
CMsf() {
m_dwMsf = 0;
}
CMsf(DWORD dwMsf) {
m_dwMsf = dwMsf;
}
CMsf(BYTE minute, BYTE second, BYTE frame) {
m_dwMsf = MCI_MAKE_MSF(minute, second, frame);
}
operator DWORD() const {return m_dwMsf;}
BYTE GetMinute() const { return MCI_MSF_MINUTE(m_dwMsf); }
BYTE GetSecond() const { return MCI_MSF_SECOND(m_dwMsf); }
BYTE GetFrame() const { return MCI_MSF_FRAME(m_dwMsf); }
protected:
DWORD m_dwMsf;
};
class CTmsf {
public:
CTmsf() {
m_dwTmsf = 0;
}
CTmsf(DWORD dwTmsf) {
m_dwTmsf = dwTmsf;
}
CTmsf(BYTE track, BYTE minute, BYTE second, BYTE frame) {
m_dwTmsf = MCI_MAKE_TMSF(track, minute, second, frame);
}
operator DWORD() const {return m_dwTmsf;}
BYTE GetTrack() const { return MCI_TMSF_TRACK(m_dwTmsf); }
BYTE GetMinute() const { return MCI_TMSF_MINUTE(m_dwTmsf); }
BYTE GetSecond() const { return MCI_TMSF_SECOND(m_dwTmsf); }
BYTE GetFrame() const { return MCI_TMSF_FRAME(m_dwTmsf); }
protected:
DWORD m_dwTmsf;
};
//////////////////////////////////////////////////////////////////////////
// The CMciDevice class is the base class for all MCI devices
//
class CMciDevice {
public:
// Common modes
static const DWORD ModeNotReady;
static const DWORD ModePause;
static const DWORD ModePlay;
static const DWORD ModeStop;
static const DWORD ModeOpen;
static const DWORD ModeRecord;
static const DWORD ModeSeek;
// Common status items
static const DWORD StatusReady;
static const DWORD StatusMediaPresent;
static const DWORD StatusMode;
static const DWORD StatusNumberOfTracks;
// Common capabilites
static const DWORD GetdevcapsCanEject;
static const DWORD GetdevcapsCanPlay;
static const DWORD GetdevcapsCanRecord;
static const DWORD GetdevcapsCanSave;
static const DWORD GetdevcapsCompound;
static const DWORD GetdevcapsDeviceType;
static const DWORD GetdevcapsHasAudio;
static const DWORD GetdevcapsHasVideo;
static const DWORD GetdevcapsUsesFiles;
// Device Info
static const DWORD InfoProduct;
// Device types
static const DWORD DevtypeAnimation;
static const DWORD DevtypeCdaudio;
static const DWORD DevtypeDat;
static const DWORD DevtypeDigitalvideo;
static const DWORD DevtypeOther;
static const DWORD DevtypeOverlay;
static const DWORD DevtypeScanner;
static const DWORD DevtypeSequencer;
static const DWORD DevtypeVcr;
static const DWORD DevtypeVideodisc;
static const DWORD DevtypeWaveaudio;
// Construction/Destruction
CMciDevice();
~CMciDevice();
// Open/Close: All derived classes must implement them
virtual DWORD Open(DWORD dwDeviceType, BOOL bShareable = FALSE);
virtual DWORD Open(LPCSTR lpstrName, BOOL bShareable = FALSE);
virtual DWORD Close();
// Attaches the device to a MCI device already opened
inline void Attach(UINT wDeviceID);
// Gets device ID
MCIDEVICEID GetDeviceID() const;
// Closes all open MCI devices: wait until devices are closed
static DWORD CloseAll();
// Retrieves a device static information
DWORD GetDevCaps(DWORD dwDevcaps, BOOL bItem = FALSE);
// Retrieves a device status item
virtual DWORD GetStatus(DWORD dwStatusItem);
// Retrieves the device mode
virtual DWORD GetMode();
// Retrieves a string information from the device
virtual DWORD GetInfo(DWORD dwInfo, LPSTR lpstrReturn, DWORD dwRetSize);
// Get/Set Callback Window
HWND GetCallbackHwnd() const;
void SetCallbackWnd(CWnd* pWnd);
void SetCallbackWnd(HWND hWnd);
// Sets MCI error report on/off
void ReportErrors(BOOL bReport = TRUE);
protected:
// mciSendCommand with error handling
DWORD SendCommand(UINT uMsg, DWORD fdwCommand, DWORD dwParam);
// MCI error report
static void ShowError(DWORD dwError);
MCIERROR GetLastError() const;
// Data members
protected:
MCIDEVICEID m_wDeviceID; // The device ID
HWND m_hMainWnd; // The callback window handle
private:
MCIERROR m_dwLastError; // The last error code
BOOL m_bReportErrors; // Report MCI errors?
};
#endif // !defined(AFX_MCI_H_098R22G3234_23453_235124_123A44HQ13451_INCLUDED_)
|
|
|
|
|
This is also a header file, right? Could you please post the .cpp where all this gets included? (It is not necessary that you post the entire file, just till the offending inclusion).
Also, please tick on the "Display this message as-is (no HTML)" checkbox right below the edit area --otherwise '<' characters mess up with the HTML.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Sorry but I don't know which part of the code I have to give you so I prefer to give you the all thing...
SORRY FOR THE INCONVENIENCE
#include "stdafx.h"
#include "mci.h"
//////////////////////////////////////////////////////////////////////////
// CMciDevice implementation
//
// Common Modes
const DWORD CMciDevice::ModeNotReady = MCI_MODE_NOT_READY;
const DWORD CMciDevice::ModePause = MCI_MODE_PAUSE;
const DWORD CMciDevice::ModePlay = MCI_MODE_PLAY;
const DWORD CMciDevice::ModeStop = MCI_MODE_STOP;
const DWORD CMciDevice::ModeOpen = MCI_MODE_OPEN;
const DWORD CMciDevice::ModeRecord = MCI_MODE_RECORD;
const DWORD CMciDevice::ModeSeek = MCI_MODE_SEEK;
// Common status
const DWORD CMciDevice::StatusReady = MCI_STATUS_READY;
const DWORD CMciDevice::StatusMediaPresent = MCI_STATUS_MEDIA_PRESENT;
const DWORD CMciDevice::StatusMode = MCI_STATUS_MODE;
const DWORD CMciDevice::StatusNumberOfTracks = MCI_STATUS_NUMBER_OF_TRACKS;
// Common capabilites
const DWORD CMciDevice::GetdevcapsCanEject = MCI_GETDEVCAPS_CAN_EJECT;
const DWORD CMciDevice::GetdevcapsCanPlay = MCI_GETDEVCAPS_CAN_PLAY;
const DWORD CMciDevice::GetdevcapsCanRecord = MCI_GETDEVCAPS_CAN_RECORD;
const DWORD CMciDevice::GetdevcapsCanSave = MCI_GETDEVCAPS_CAN_SAVE;
const DWORD CMciDevice::GetdevcapsCompound = MCI_GETDEVCAPS_COMPOUND_DEVICE;
const DWORD CMciDevice::GetdevcapsDeviceType = MCI_GETDEVCAPS_DEVICE_TYPE;
const DWORD CMciDevice::GetdevcapsHasAudio = MCI_GETDEVCAPS_HAS_AUDIO;
const DWORD CMciDevice::GetdevcapsHasVideo = MCI_GETDEVCAPS_HAS_VIDEO;
const DWORD CMciDevice::GetdevcapsUsesFiles = MCI_GETDEVCAPS_USES_FILES;
const DWORD CMciDevice::InfoProduct = MCI_INFO_PRODUCT;
const DWORD CMciDevice::DevtypeAnimation = MCI_DEVTYPE_ANIMATION;
const DWORD CMciDevice::DevtypeCdaudio = MCI_DEVTYPE_CD_AUDIO;
const DWORD CMciDevice::DevtypeDat = MCI_DEVTYPE_DAT;
const DWORD CMciDevice::DevtypeDigitalvideo = MCI_DEVTYPE_DIGITAL_VIDEO;
const DWORD CMciDevice::DevtypeOther = MCI_DEVTYPE_OTHER;
const DWORD CMciDevice::DevtypeOverlay = MCI_DEVTYPE_OVERLAY;
const DWORD CMciDevice::DevtypeScanner = MCI_DEVTYPE_SCANNER;
const DWORD CMciDevice::DevtypeSequencer = MCI_DEVTYPE_SEQUENCER;
const DWORD CMciDevice::DevtypeVcr = MCI_DEVTYPE_VCR;
const DWORD CMciDevice::DevtypeVideodisc = MCI_DEVTYPE_VIDEODISC;
const DWORD CMciDevice::DevtypeWaveaudio = MCI_DEVTYPE_WAVEFORM_AUDIO;
CMciDevice::CMciDevice() {
m_wDeviceID = NULL;
m_hMainWnd = NULL;
m_bReportErrors = FALSE;
}
CMciDevice::~CMciDevice() {
}
// Open by device name (obtained by the registry or system.ini)
DWORD CMciDevice::Open(LPCSTR lpstrName, BOOL bShareable /*=FALSE*/)
{
ASSERT(lpstrName != NULL);
DWORD dwReturn;
MCI_OPEN_PARMS mciOpenParms;
// Open a device by specifying the device name.
mciOpenParms.lpstrDeviceType = lpstrName;
DWORD dwFlags = MCI_OPEN_TYPE|MCI_WAIT;
if (bShareable) dwFlags |= MCI_OPEN_SHAREABLE;
dwReturn = SendCommand(MCI_OPEN, dwFlags, (DWORD)(LPVOID) &mciOpenParms);
if (dwReturn == 0) {
// The device opened successfully; get the device ID.
m_wDeviceID = mciOpenParms.wDeviceID;
}
return dwReturn;
}
// Open by device type
DWORD CMciDevice::Open(DWORD dwDeviceType, BOOL bShareable /*=FALSE*/)
{
DWORD dwReturn;
MCI_OPEN_PARMS mciOpenParms;
// Opens a device by specifying a device-type constant.
mciOpenParms.lpstrDeviceType = (LPCSTR) dwDeviceType;
DWORD dwFlags = MCI_OPEN_TYPE|MCI_OPEN_TYPE_ID|MCI_WAIT;
if (bShareable) dwFlags |= MCI_OPEN_SHAREABLE;
dwReturn = SendCommand(MCI_OPEN, dwFlags,
(DWORD)(LPVOID) &mciOpenParms);
if (dwReturn == 0) {
// The device opened successfully; get the device ID.
m_wDeviceID = mciOpenParms.wDeviceID;
}
return dwReturn;
}
// Closes the device
DWORD CMciDevice::Close() {
MCI_GENERIC_PARMS mciGenericParms;
mciGenericParms.dwCallback = (DWORD) m_hMainWnd;
return SendCommand(MCI_CLOSE, 0, (DWORD) &mciGenericParms);
}
// Gets the current callback window
HWND CMciDevice::GetCallbackHwnd() const {
return m_hMainWnd;
}
// Set the current callback window
void CMciDevice::SetCallbackWnd(CWnd *pWnd) {
ASSERT(pWnd != NULL);
m_hMainWnd = pWnd->GetSafeHwnd();
}
// Set the current callback window
void CMciDevice::SetCallbackWnd(HWND hWnd) {
ASSERT(hWnd != NULL);
m_hMainWnd = hWnd;
}
// Attaches the MCI device to a device already opened
void CMciDevice::Attach(UINT wDeviceID) {
m_wDeviceID = wDeviceID;
}
// Gets the device ID
MCIDEVICEID CMciDevice::GetDeviceID() const {
return m_wDeviceID;
}
// mciSendCommand with error handling
DWORD CMciDevice::SendCommand(UINT uMsg, DWORD fdwCommand, DWORD dwParam) {
DWORD dwReturn;
if (dwReturn = mciSendCommand(m_wDeviceID, uMsg, fdwCommand, dwParam)) {
m_dwLastError = dwReturn;
if (m_bReportErrors)
ShowError(dwReturn);
}
return dwReturn;
}
MCIERROR CMciDevice::GetLastError() const {
return m_dwLastError;
}
// Generic MCI_GETDEVCAPS_ITEM command: good for all devices
DWORD CMciDevice::GetDevCaps(DWORD dwDevcaps, BOOL bItem /*=FALSE*/) {
MCI_GETDEVCAPS_PARMS mciCapsParms;
mciCapsParms.dwCallback = (DWORD) m_hMainWnd;
mciCapsParms.dwReturn = 0;
if (bItem) {
mciCapsParms.dwItem = dwDevcaps;
dwDevcaps |= MCI_GETDEVCAPS_ITEM;
}
SendCommand(MCI_GETDEVCAPS, dwDevcaps, (DWORD) &mciCapsParms);
return mciCapsParms.dwReturn;
}
// Generic MCI_INFO command
DWORD CMciDevice::GetInfo(DWORD dwInfo, LPSTR lpstrReturn, DWORD dwRetSize) {
MCI_INFO_PARMS mciInfoParms;
mciInfoParms.dwCallback = (DWORD) m_hMainWnd;
mciInfoParms.lpstrReturn = lpstrReturn;
mciInfoParms.dwRetSize = dwRetSize;
return SendCommand(MCI_INFO, dwInfo, (DWORD) &mciInfoParms);
}
// Set error report on/off
void CMciDevice::ReportErrors(BOOL bReport /*=TRUE*/) {
m_bReportErrors = bReport;
}
// Uses mciGetErrorString to get a textual description of an MCI error.
// Displays the error description using MessageBox.
void CMciDevice::ShowError(DWORD dwError)
{
char szErrorBuf[MAXERRORLENGTH];
MessageBeep(MB_ICONEXCLAMATION);
CWnd* pMainWnd = AfxGetApp()->m_pMainWnd;
ASSERT(pMainWnd != NULL);
HWND hMainWnd = pMainWnd->GetSafeHwnd();
if(mciGetErrorString(dwError, (LPSTR) szErrorBuf, MAXERRORLENGTH)) {
MessageBox(hMainWnd, szErrorBuf, _T("MCI Error"),
MB_ICONEXCLAMATION);
}
else
MessageBox(hMainWnd, _T("Unknown Error"), _T("MCI Error"),
MB_ICONEXCLAMATION);
}
// Closes all MCI devices opened by the application.
// Waits until devices are closed before returning.
DWORD CMciDevice::CloseAll()
{
DWORD dwReturn;
if (dwReturn = mciSendCommand(MCI_ALL_DEVICE_ID, MCI_CLOSE, MCI_WAIT, NULL))
ShowError(dwReturn);
return dwReturn;
}
DWORD CMciDevice::GetMode() {
return GetStatus(StatusMode);
}
// Generic MCI_STATUS command
DWORD CMciDevice::GetStatus(DWORD dwItem) {
MCI_STATUS_PARMS mciStatusParms;
mciStatusParms.dwCallback = (DWORD) m_hMainWnd;
mciStatusParms.dwItem = dwItem;
mciStatusParms.dwReturn = 0;
SendCommand(MCI_STATUS, MCI_STATUS_ITEM, (DWORD) &mciStatusParms);
return mciStatusParms.dwReturn;
}
|
|
|
|
|