|
in my progarm (special to deal with data), i need good expressions for 2,4,8,16 based integers.
for example, in c++, we use 0x... to stand for 16 based data.
so, expressions i try to use are:
0b... (2 based)
0f... (4 based)
0o... (8 based)
0x... (16 based)
but i am afraid that expressions above are not good.
i hope i can use common or popular expressions.
do you know expressions which are accepted already by people for different based integers?
|
|
|
|
|
Base-2 and base-8 numbers already have a known prefix. Why the change? What exactly are you trying to do?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
hey!
m working on a code where in i have to write to a board. the system and the board are connected via UART. m using VC++. the problem is that the moment i try to write a character the system hangs. here is a part of the code -
void CserialportthingieDlg::OnBnClickedWrite()
{
UpdateData(TRUE);
size_t size;
size = strlen(m_sshwwrite);//m_sshwwrite is he variable associated with the editbox
int i;
i=size-1;
asd->WriteByte(m_sshwwrite[i]);//asd is an instance of the class SerialCom where in i writebyte has been defined.
}
the definition of writebyte is --
BOOL CSerialCom::WriteByte(BYTE bybyte)
{
iBytesWritten=0;
if(WriteFile(hComm,&bybyte,1,&iBytesWritten,NULL)==0)
return false;
else
return true;
}
please let me know if any thing is wrong with the code or tell me a better way.
thanks a lot!
regards
lovy
|
|
|
|
|
How do you set the serial port timeouts (remember: WriteFile is a blocking call)?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
actually i had set some arbit time out.
now even when i restored it to the default value the system still hangs!
help me out!
thanks
regards
lovy
|
|
|
|
|
Post the relevant code (i.e. port open, DCB definition, etc..)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
If WriteFile() is failing, call GetLastError() to find out why.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
May be you are setting the wrong kind of handshaking. If you are setting hardware handshake, unless the board on the other end sets the relevant lines in the port, the WriteFile will wait until the port timeout (if I remember it correctly).
There are variables in the DCB structure that need to be set for setting the handshake mode(None, Software, or Hardware).
Also you could check if the board is working by trying it with HyperTerminal first with the correct Handshaking.
this is this.
|
|
|
|
|
Hello. I am new to MFC and C++ in general. I am interested in how to get the lower and higher parts of a DWORD variable?
|
|
|
|
|
I guess you're looking for the HIWORD and LOWORD macros. MSDN docs are here[^]
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Have a llot at LOWORD and similar macros on MSDN http://msdn2.microsoft.com/en-us/library/ms632659.aspx[^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
After I switched from VS2003 to VS2005 the Windows error sound comes up when I close my application but there's no error message.
The only changes I made in the code are the ones required to make it VS2005 compatible.
|
|
|
|
|
Are you sure there is no MessageBeep() in your code ?
Just guessing
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
That's Microsoft's way of making your application more multimedia robust!
If you run in the debugger, do you see any exception/error/assert messages in the Output window
during shutdown?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
Can you more explain about your program?
|
|
|
|
|
I found the problem. It was a third party library which caused it.
I've got a new version of that library and now the problem is fixed.
Thanks everyone!
|
|
|
|
|
Hello Friends
I have seen few toolbars that reduce size of desktop window & locate them on the top.
Any idea how they do that?
In case i try GetDeskTopWindow & do a MoveSize it does not works?
Regards
|
|
|
|
|
vikrant kpr wrote: I have seen few toolbars that reduce size of desktop window & locate them on the top.
Any idea how they do that?
Look up SHAppBarMessage .
|
|
|
|
|
See this[^] article does helpful for you?
|
|
|
|
|
I am having windows media player as activex control
in my application. I am trying to use create method
for same but I am not able to use. Some where I am missing something.
CWMPPlayer4 m_lplayer;
void CApl2IEDlg::OnButton1()
{
RECT lprect;
lprect.bottom = 0;
lprect.left = 0;
lprect.right = 100;
lprect.top = 100;
RegisterWindow();
CWMPPlayer4 cwmp;
cwmp.Create(m_lplayer,mediaclass,0,lprect,(CWnd*)m_hWnd,0,NULL);
}
LRESULT FAR PASCAL WndProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
return (DefWindowProc(hWnd, Message, wParam, lParam));
}
void CApl2IEDlg::RegisterWindow()
{
mediaclass = "mediaclass";
WNDCLASS wndclass;
wndclass.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = AfxGetInstanceHandle();
wndclass.hIcon = LoadIcon(NULL,_T(""));
wndclass.hCursor = LoadCursor(NULL,IDC_ARROW);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = mediaclass;
}
|| Lust Causes Sorrow ||
|
|
|
|
|
It looks like you might be using the wrong Create() for an activex control.
Make sure you're calling a Create() method from the wrapper class for the control.
To create the wrapper class (if you haven't already), you can use Project Menu/Add Class/MFC/
MFC Class from ActiveX Control.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
I am using create method which is there in .cpp file which gets loaded once we insert control from registered controls. We can use other methods, Cant we use create?
Anyway I will try your suggestion tomorrow. But every time I try to create window for control this problem comes. I am really fed up of ActiveX controls but I have to use.
|| ART OF LIVING ||
|
|
|
|
|
shivditya wrote: I am using create method which is there in .cpp file which gets loaded once we insert control from registered controls
Hmm - I don't know what version of Visual Studio you're using, but I get two Create methods in
a wrapper class on Visual C++ 2003:
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT& rect, CWnd* pParentWnd, UINT nID,
CCreateContext* pContext = NULL);
BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd,
UINT nID, CFile* pPersist = NULL, BOOL bStorage = FALSE,
BSTR bstrLicKey = NULL);
Neither of these match the parameters you are passing to Create().
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
Also...
The title of your post is "How to change place of activex control at run time".
Are you just wanting to change the position/size of the control or create the control at runtime?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
I am using version of VC++ version 6.0. I dont understand your concept of wrapper class. The classes gets automatically created once you place activex control.
So I feel version in not required. The defination of create() which I have written is one which comes in Active X controls self generated classes.
Any way I done one mistake I dont need to create
control at runtime. I just need to change place at runtime so that I can save my text display. I got my own answer I have to get window then rect and change place. My current problem is diverted,but still these create remains problem.
#if !defined(AFX_WMPPLAYER4_H__29950495_92A5_48C7_A665_14C10BA68140__INCLUDED_)
#define AFX_WMPPLAYER4_H__29950495_92A5_48C7_A665_14C10BA68140__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++
// NOTE: Do not modify the contents of this file. If this class is regenerated by
// Microsoft Visual C++, your modifications will be overwritten.
// Dispatch interfaces referenced by this interface
class CWMPControls;
class CWMPSettings;
class CWMPMedia;
class CWMPMediaCollection;
class CWMPPlaylistCollection;
class CWMPNetwork;
class CWMPPlaylist;
class CWMPCdromCollection;
class CWMPClosedCaption;
class CWMPError;
class CWMPDVD;
class CWMPPlayerApplication;
/////////////////////////////////////////////////////////////////////////////
// CWMPPlayer4 wrapper class
class CWMPPlayer4 : public CWnd
{
protected:
DECLARE_DYNCREATE(CWMPPlayer4)
public:
CLSID const& GetClsid()
{
static CLSID const clsid
= { 0x6bf52a52, 0x394a, 0x11d3, { 0xb1, 0x53, 0x0, 0xc0, 0x4f, 0x79, 0xfa, 0xa6 } };
return clsid;
}
virtual BOOL Create(LPCTSTR lpszClassName,
LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT& rect,
CWnd* pParentWnd, UINT nID,
CCreateContext* pContext = NULL)
{ return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID); }
BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT& rect, CWnd* pParentWnd, UINT nID,
CFile* pPersist = NULL, BOOL bStorage = FALSE,
BSTR bstrLicKey = NULL)
{ return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID,
pPersist, bStorage, bstrLicKey); }
// Attributes
public:
// Operations
public:
void close();
CString GetUrl();
void SetUrl(LPCTSTR lpszNewValue);
long GetOpenState();
long GetPlayState();
CWMPControls GetControls();
CWMPSettings GetSettings();
CWMPMedia GetCurrentMedia();
void SetCurrentMedia(LPDISPATCH newValue);
CWMPMediaCollection GetMediaCollection();
CWMPPlaylistCollection GetPlaylistCollection();
CString GetVersionInfo();
void launchURL(LPCTSTR bstrURL);
CWMPNetwork GetNetwork();
CWMPPlaylist GetCurrentPlaylist();
void SetCurrentPlaylist(LPDISPATCH newValue);
CWMPCdromCollection GetCdromCollection();
CWMPClosedCaption GetClosedCaption();
BOOL GetIsOnline();
CWMPError GetError();
CString GetStatus();
CWMPDVD GetDvd();
CWMPPlaylist newPlaylist(LPCTSTR bstrName, LPCTSTR bstrURL);
CWMPMedia newMedia(LPCTSTR bstrURL);
BOOL GetEnabled();
void SetEnabled(BOOL bNewValue);
BOOL GetFullScreen();
void SetFullScreen(BOOL bNewValue);
BOOL GetEnableContextMenu();
void SetEnableContextMenu(BOOL bNewValue);
void SetUiMode(LPCTSTR lpszNewValue);
CString GetUiMode();
BOOL GetStretchToFit();
void SetStretchToFit(BOOL bNewValue);
BOOL GetWindowlessVideo();
void SetWindowlessVideo(BOOL bNewValue);
BOOL GetIsRemote();
CWMPPlayerApplication GetPlayerApplication();
void openPlayer(LPCTSTR bstrURL);
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_WMPPLAYER4_H__29950495_92A5_48C7_A665_14C10BA68140__INCLUDED_)
|| Lust Causes Sorrow ||
|
|
|
|
|