|
You need to add
USES_CONVERSION;
somewhere in your source. See MSDN for details.
The opinions expressed in this communication do not necessarily represent those of the author (especially if you find them impolite, discourteous or inflammatory).
|
|
|
|
|
Use
BSTR bstrName=::SysAllocString(L"prasad");
char *charPointer=new char[256];
WideCharToMultiByte(CP_OEMCP, 0, bstrName, -1, charPointer, 256, NULL, NULL );
Alternatively you can use wrapper _bstr_t
_bstr_
|
|
|
|
|
oops! sorry i'm confused a bit.. that removal of * didn't work. .. sorry. i'll try your way now
|
|
|
|
|
I'm using
USES_CONVERSION;
strncpy(sz,OLE2T(bstr), 25);
please note that is not secure to use strcpy, due buffer overflow attacks.
Thats why you should use strncpy
|
|
|
|
|
Hi, I notice many 3D CAD systems have treeviews on top of the 3D view of the drawings(rendered by OpenGL or Direct3D), and I would like to know how it is being done.
I believe the pixels are blitted from the bitmap of the treeview onto the framebuffer of the 3D view, and this is the part I am familar with.
What I don't know is whether the treeview is just the standard treeview in Windows, and how to program it so that the actual treeview is invisible, and how all the mouse clicking stuff works.
Does anyone have any idea?
TIA
|
|
|
|
|
This is a simple code to insert some string at
a given cursor position for CEdit
CPoint point;
::GetCursorPos( &point );
m_ScriptWin.ScreenToClient(&point);
int CharPos = m_ScriptWin.CharFromPos( point );
m_ScriptWin.SetSel(CharPos,CharPos,TRUE);
m_ScriptWin.ReplaceSel(" ***This is the inserted text*** \r\n");
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
this is one more method but havent tested it
POINT point;
::GetCursorPos( &point );
m_Edit.ScreenToClient(&point);
int CharPos = m_Edit.CharFromPos( point );
WORD charind = LOWORD(CharPos);
CString s;
m_Edit.GetWindowText(s);
s = s.Left(charind)+"mystring"+s.Right(s.GetLength()-charind);
m_Edit.SetWindowText(s);
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
|
yeh actully
i need to get the MAC address from
the user but , i didnot find any
such control for it .
So i was trying to create a control
which will get the string for the
user and returns an array of six
string containing the parsed MAC add
Something like the IP Address control.
If u know any link from were i can get
the control for MAC address do post me.
Thanks for you concern
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
One way is with Netbios() . Another way is with GetAdaptersInfo() .
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
|
V
|
|
|
|
|
I have a small problem were i need to
change the back color of the CEdit & CStatic
control , is there any simple code for the
same.
Yeh and how can i change the font color in
CEdit.
thank u
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
use ON_WM_CTLCOLOR message
|
|
|
|
|
Cool! Learn something new everyday!
I suppose this is faster (performance wise) than use a derived class from CEdit etc and doing DrawItem ect. And much simpler.
|
|
|
|
|
first of all Thank u for your reply
I am using a MFC application
were i am displaying a Dialogbox
were i have a CEdit control .
Which is suppose to change the colour
when a user enters invalid entry (non-numeric)
I dont wont to touch the base class (CEdit)
or nor want to derive new class from it .
ON_WM_CTLCOLOR
I need some solution i have tried to get the
"Device Context "of the edit box but it could
not print inside rather it printed outside the
Edit box .
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
first of all Thank u for your reply
I am using a MFC application
were i am displaying a Dialogbox
were i have a CEdit control .
Which is suppose to change the colour
when a user enters invalid entry (non-numeric)
I dont wont to touch the base class (CEdit)
or nor want to derive new class from it .
ON_WM_CTLCOLOR
I need some solution i have tried to get the
"Device Context "of the edit box but it could
not print inside rather it printed outside the
Edit box .
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Use that message and handle it, amin, it is very easy. Do a search on the web you will get an example in msdn. I just spent 5 min doing that and get a test case working.
As to the number thing, you should be able to config the edit ctrl to accept number only. In the code, you may be able to use something like this:
DDV_MinMaxLong(...) <-- check reference how to use it. It's been a while since I last use them.
What u will get is if user inputs an invalid entry, a messagebox will come up telling him so. You do not even need to change the CEdit color to let him know.
|
|
|
|
|
Thank you very much
i have got the code working now
The client requirement was to change the colour of the
dialog box so i had to do that .
just pasted the code for other programers
Example<br />
<br />
<br />
HBRUSH CZilchDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) <br />
{<br />
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);<br />
<br />
if (pWnd->GetDlgCtrlID() == IDC_MYSTATIC)<br />
{<br />
pDC->SetTextColor(RGB(255, 0, 0));<br />
<br />
pDC->SetBkMode(TRANSPARENT);<br />
<br />
hbr = m_brush;<br />
}<br />
<br />
return hbr;<br />
}<br />
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
I am using URLDownloadToFile to download a url, but default download manager like DAP intercepting the download. Is there a way to make it downloadable without using default download manager.
|
|
|
|
|
Does anyone know how you can add an effect over a timeline track, with a lower priority over a transition applied on the same track using DirectShow Editing Services?
I have 2 video tracks with a transition between them, the first track contains green colored areas (0, 255, 0) and the second track is applied over the first using a key transition over the green areas. I want to add an effect over the first track (e.g. Grayscale)... now the problem is that the effect applies itself before the transition, thus changing the key transition color, and the second track doesn't appear anymore.
Is there anyway to apply the effect after the transition?
Thank you!
|
|
|
|
|
Do you people ever come across problem that this does not work?
HBITMAP hBmp = ::LoadBitmap(NULL, MAKEINTRESOURCE(IDB_BITMAP2));
I got 0 returned by the above func. Why? I am always in a bit of struggle with bitmap as I have not done much with it. Anyone can shed some light?
My bitmap is created in dev studio.
|
|
|
|
|
You have to pass the handle to the application instance as first parameter function.
|
|
|
|
|
The code is from Msdn website. I just mangaged to get it work:
BOOL CMFCPlayingPenDlg::OnInitDialog()<br />
{<br />
CDialog::OnInitDialog();<br />
.....<br />
DWORD dwStyle = WS_CHILD|WS_VISIBLE|SS_BITMAP|SS_CENTERIMAGE;<br />
m_staticX.ModifyStyleEx(0, dwStyle);<br />
HBITMAP hBmp = ::LoadBitmap(0, MAKEINTRESOURCE (IDB_BITMAP1));<br />
m_staticX.SetBitmap(hBmp);<br />
}
The strange thing is that I did not change much but this time bitmap was loaded. However, the bitmap does not appear on my static ctrl...
|
|
|
|
|
Is that working if you pass the handle of the application instance as first parameter as I suggested in my first post ?
Laffis wrote:
The strange thing is that I did not change much
Laffis wrote:
HBITMAP hBmp = ::LoadBitmap(0, MAKEINTRESOURCE (IDB_BITMAP1));
What did you change EXACTLY at this line of code (post what was shown on the MSDN website).
|
|
|
|