|
Try in the CLI u might get the proper response
as people here are yet on vc++
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Crap! I thought CLI was for regular (non-Visual) C++... where's that then?
Thanks!
BTW, David, I don't know how to do it in C++, but in C# you used:
using System.Windows.Forms;
It should be quite similar...
Lord Kixdemp
www.SulfurMidis.com
www.SulfurSoft.tk
[ftp://][http://][hotline://]tsfc.ath.cx
|
|
|
|
|
There is an icon ,and I want to set the icon as a item's image without backgroud color in a CTreeCtrl in MFC.
How do I do?
attaching my code:
hIcon=(HICON)LoadImage(NULL,GetIconFromFile ("CLSDFOLD"),IMAGE_ICON,16,16,LR_LOADFROMFILE|LR_DEFAULTSIZE);
iconIndex=m_DeviceImage.Add (hIcon);
HTREEITEM hti1=m_wndDeviceTree.InsertItem
(_T("CATEGORY"),iconIndex,iconIndex,hti);
DestroyIcon(hIcon);
The icon is able to display,but it is black backgroud color.why??
help me
would you write some code?
|
|
|
|
|
Try:
LoadImage(NULL,GetIconFromFile ("CLSDFOLD"),IMAGE_ICON,16,16,LR_LOADTRANSPARENT|LR_LOADFROMFILE|LR_DEFAULTSIZE);
Gavin Taylor
w: http://www.gavspace.com
|
|
|
|
|
Hi,
i have created a plugin for Windows media services4.1 by using COM and VC++. And also set the registry settings.
But,after completing all the necessary settings,also windows media server not reconizing the plugin.
How can i solve this problem.
i am using the windows media services 4.1 which come along with "winodws 2000 server" OS
Spend Every minute for sucess
|
|
|
|
|
I have a number like 400
I have another number like 666
Is there anyway using bitwise operators I can extract ONLY the bits which are used to make 400 and determine if all those bits are set???
I have read PJ Arends bitwise article numerous times, but still I am missing something and I need this for a solution...
Basically MASK only certin bits and determine if all are set???
Is this possible? Can you show me how please???
It's frustrating being a genius and living the life of a moron!!!
|
|
|
|
|
Hockey wrote: Is there anyway using bitwise operators I can extract ONLY the bits which are used to make 400...
if ((666 & 400) == 400)
... Hockey wrote: Basically...determine if all are set???
This makes no sense. If all of the bits of a number are set, then the number is 'fully intact' (i.e., there's nothing to test).
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Basically whats happening here is I am trying to determine which checkboxes in an FTP program should be checked...
Based on the linux permissions of the file...
So, For example:
777 would require all the checkboxes RWX for Owner/Group/Other to be checked...
Whereas 400, would require ONLY the READ/Owner to be checked...
I have the permission bits, ie: 777 or 666 or 400...
Now i'm trying to use this number and programatically determine which of the corresponding checkboxes need to be checked...
I cannot use any FTP helper functions, etc...I must do this completely independant of any library...
The reason I asked if it's possible to localize a certain number inside another...is because...
400 in binary = 110010000 - 3 bits are SET, but ONLY one checkbox (READ/Owner is checked)
However, 666 in binary = 1010011010 - 5 bits are SET and all READ/WRITE for Owner, Group, Other are checked!!!
A trivial:
((666 & 400) == 400)
Doesn't work!!! I'm not sure why it doesn't work...but it doesn't work...atleast the last time I tried it it didn't work
Now does it make sense what I am trying to accomplish???
Any ideas???
It's frustrating being a genius and living the life of a moron!!!
|
|
|
|
|
666 => 1010011010
400 => 0110010000
bitwise & => 0010010000
It probably will not match 400 ( 0110010000 ).
In Unix, those permission are in octet.
So, you may want to try
((0666 & 0400 ) == 0400 )
If I understand your problem correctly, I probably will try
different approach.
You probably have 9 checkbox for all permissions.
I probably will have a function to take the
permission & all 9 checkbox.
Inside the function.
if ( permission & 0400 )
ownerRead->SetCheck ( TRUE);
if ( permission & 0200 )
ownerWrite->SetCheck ( TRUE);
& etc.
Kevin
|
|
|
|
|
You're missing the fact that the Unix numerical permissions are octal (base 8) numbers. This means 400 octal is 100000000 in binary and 666 octal is 101101101 in binary.
|
|
|
|
|
Indeed. Each digit in an octal number, is represented by three bits in the binary number system. E.g: base 8: xyz => base 2: x0x1x2y0y1y2z0z1z2
--
Pictures[^] from my Japan trip.
|
|
|
|
|
markkuk wrote: ...and 666 octal is 101101101 in binary.
Correction. 666 in base 8 is 110110110 in base 2.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
I have an SDI app with several views (mostly CFormView), one of which is a CEditView class. From this class I need to add a "centered" heading with a larger font and set a decent margin to print only text.
I would like some help understanding how to use OnPreparePrinting, OnBeginPrinting, and OnEndPrinting functions that are already in my edit class. I know there are a few classes for printing but if I don't understand how it all works, they are of little value to me.
Another problem is that the book stores in my area have mostly .NET stuff and I'm using VC++ 6.0.
Thanks!
Mark
|
|
|
|
|
Printing in an MFC app is supposed to be just like drawing on the screen. The On...Printing functions are there to help you in the places that drawing during printing is different. The main difference is that, when printing, you probably want to keep track of pages. For example, if you're printing text, you wouldn't want to print the top half of a line on one page, and the bottom half on the next.
If your view class is derived from CEditView, you might look to see if CEditView has any printing support built-in.
Software Zen: delete this;
|
|
|
|
|
I've got two structs that I want to be able to typecast to one another, so I have something like this:
struct S1
{
S1( const S2 &s2 ) { a = s2.b }
float a;
};
struct S2
{
S2( const S1 &s1 ) { b = s1.a }
float b;
}; But each struct needs to know about the other, so I can't get this to compile. Is there a way to tell each class the other exists or some other way to get around this?
- Steve
|
|
|
|
|
use a "forward declaration" of S2 prior to defining S1:
struct S2;
struct S1
{
//
};
struct S2
{
//
};
http://www.catch22.net
|
|
|
|
|
Hi,
I have a CFormView-based SDI project in which I need to programmatically create & update an array of buttons in a view window. It seems that a CFormView would be the best class to use for this window, but I can't seem to create the window. What type of parent should the window have? I need to create it in the app's main CFormView window. Can that be done? Can anyone point me to a sample project?
Thanks,
Royce
|
|
|
|
|
A CFormView is basically a modeless dialog. It's nothing special really. What window fails to create? The buttons, or the CFormView?
--
Pictures[^] from my Japan trip.
|
|
|
|
|
The CFromView fails to create a window when the class ctor is called.
|
|
|
|
|
You cannot create child controls in the constructor, because the window is not created yet. You see, the CFormView object is nothing but a wrapper around a HWND (window handle). You will have much better luck if you create the child controls in OnInitialUpdate() (that is a virtual method which you can override, and is found in the classwizard).
All MFC window/control* classes are only wrappers around window handles, they are not windows themselves. They merely present a C++-friendly interface (some may disagree with this) to the messaging protocols which the window supports.
--
Pictures[^] from my Japan trip.
-- modified at 8:56 Sunday 4th December, 2005
|
|
|
|
|
Jörgen Sigvardsson wrote: They merely present a C++-friendly interface (some may disagree with this)
Aw, don't spoil his fun, Jörgen .
Software Zen: delete this;
|
|
|
|
|
Yes, I understand all that. It is the creation of the CFormview window that I am having trouble with. How and when do I create it? Must it be a child of a CFrameWnd? Can it be a child of another CFormView?
|
|
|
|
|
Hi, everyone!
My current project is an application to control the 3-axis table for the optical microscope. The each stepping motor can be controlled by the serial communication port using the ASCII text format.
Now, I would like to know which COM port is connected or not.
Is there any method to list the connected USB or COM port?
BaySeagull
|
|
|
|
|
Hi all:
I am writing a program which is a opengl like library. Finally I need to generate a bmp file to display the result. Does anybody know how to make a bmp file from c++ please???
Thanks a lot
Asura
|
|
|
|
|
Well, I guess a lot of examples you can get through the internet.
Anyway, the followings are my humble example.
<br />
<br />
BITMAPFILEHEADER bfh;<br />
BITMAPINFOHEADER bih;<br />
char* pBuffer;
<br />
<br />
bfh.bfType = ((WORD) ('M' << 8) | 'B');; <br />
bfh.bfSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + lBuffer; <br />
bfh.bfReserved1 = 0; <br />
bfh.bfReserved2 = 0; <br />
bfh.bfOffBits = sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER); <br />
<br />
bih.biSize = sizeof(BITMAPINFOHEADER);<br />
bih.biWidth = pvih->bmiHeader.biWidth;<br />
bih.biHeight = pvih->bmiHeader.biHeight;<br />
bih.biPlanes = pvih->bmiHeader.biPlanes;<br />
bih.biBitCount = pvih->bmiHeader.biBitCount;<br />
bih.biCompression = BI_RGB;<br />
bih.biSizeImage = 0; <br />
bih.biXPelsPerMeter = 0;<br />
bih.biYPelsPerMeter = 0;<br />
bih.biClrUsed = 0;<br />
bih.biClrImportant = 0;<br />
<br />
CFileDialog dlg(FALSE, _T("bmp"), NULL,<br />
OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,<br />
"BMP (*.bmp)|*.bmp|All Files (*.*)|*.*||");<br />
<br />
if(dlg.DoModal()==IDOK)<br />
{<br />
CFile file(dlg.GetPathName(), CFile::modeCreate|CFile::modeWrite);<br />
file.Write(&bfh, sizeof(BITMAPFILEHEADER));<br />
file.Write(&bih, sizeof(BITMAPINFOHEADER));<br />
file.Write(pBuffer, lBuffer);<br />
file.Close();<br />
} <br />
BaySeagull
|
|
|
|