|
I am currently working to create the windows calender in visual C++. So is there anyone who can send me either source code or explanation that how could I create it. Will waite, okay bye
Don't have time to create signature
|
|
|
|
|
Hi,
If you are using MFC, why not to use CMonthCalCtrl .
If not, take a look at Manth Calendar control in MSDN;
for example, make a search for MonthCal_SetToday function.
--
======
Arman
|
|
|
|
|
Not a Icon on a pane and a string on another pane.
I mean on the same pane with the icon on the left and the string on the right.
Thank you
|
|
|
|
|
Yes, this is possible.
You need to use the CStatusBarCtrl::SetIcon method which sets the icon for a pane in a status bar.
If you are using the Prof-UIS CExtStatusControlBar class, then you can use the following code:
<code>bool bRet = m_wndStatusBar.AddPane( IDS_PANE_TEXT, 1 );
if( !bRet )
return;
int nIndex = m_wndStatusBar.CommandToIndex( IDS_PANE_TEXT );
m_wndStatusBar.SetPaneWidth( nIndex, 100 );
HICON hPaneIcon = NULL;
HINSTANCE hInstResource =
AfxFindResourceHandle(
MAKEINTRESOURCE( IDR_PANE_ICON ),
RT_GROUP_ICON
);
ASSERT( hInstResource != NULL );
if( hInstResource != NULL )
{
hPaneIcon = (HICON)
::LoadImage(
hInstResource,
MAKEINTRESOURCE( IDR_PANE_ICON ),
IMAGE_ICON,
16,
16,
0
);
ASSERT( hPaneIcon != NULL );
}
m_wndStatusBar.GetStatusBarCtrl().SetIcon(
nIndex,
hPaneIcon
);
IDR_PANE_ICON is a resource identifier of the icon.
Best regards,
Dmitriy Yakovlev
|
|
|
|
|
i was not sure whether to post this in this forum or the xml page but i hope someone can help me.
my problem is that when i try to include an xml file to my code i get a syntax error '<' from the line "< ?xml version="1.0" encoding="utf-8" ? >" but that code has to be there just like that doesnt it? i cannot figure out why it is giving me this error.
any help would be greatly appreciated.
Thank You
- Kyle
-- modified at 1:40 Sunday 30th October, 2005
|
|
|
|
|
gr8coaster329 wrote: ?xml version="1.0" encoding="utf-8" ? >
Hi
I think you most change "< ?" to "<?" , you have an space between < and ? , ? and >
<? xml version="1.0" encoding="utf-8" ?>
Iman Ghasrfakhri
-- modified at 1:26 Sunday 30th October, 2005
|
|
|
|
|
I do have it like that. i just posted it wrong. sorry about that.
- Kyle
-- modified at 13:13 Sunday 30th October, 2005
|
|
|
|
|
How and where are you including this XML file?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: How and where are you including this XML file?
i am including it with #include "file.xml" at the top of my code.
is that wrong?
- Kyle
|
|
|
|
|
gr8coaster329 wrote: is that wrong?
Very much so. You can, however, include it as a resource in the project's .rc file.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
I have a form. I can convert that form to a bmp and
print user data and the bitmap together so that data prints
on top of the bitmap. The problem is, bitmaps print
extremely slowly (and their really big).
Any ideas on how to print the data on top of an
image quicker without programmatically recreating the
form?
Please, any response any one can give me will be
greatly appreciated.
Sincerely,
Danielle Brina (an overworked graduate student)
|
|
|
|
|
Is your app an MFC app ? If so, did you create it with support for printing ? You could create a new app with printing support to see the code you'd need to add to your app.
Alternatively, there are a number of good articles on C++ printing, with and without MFC, in the C++ section.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
> Is your app an MFC app ?
I havent created the final app yet. In the end, I hope its in
MFC.
> If so, did you create it with support for printing ? You could
> create a new app with printing support to see the code you'd need
> to add to your app.
I setup a smaller program that uses the Printing Class Library
that Richard Stringer posted. In that code, I can print a bitmap
and text together and it prints nicely. I can prompt user data
and then have that overlay the bitmap.
However, the bigger and more complicated the bitmap, the slower it
takes to print and I need big (lots of pixels) bitmaps to include
all the detail of the form. I cant figure out how to change
Stringer's printing class library to print some other image format like a tiff. If I could modify that code to print a tiff (and a
bitmap) that could overlay text, then it might print faster and
Id be happy.
If you have any ideas, please dont hesistate to email me.
Sincerely,
Danielle Brina (an overworked graduate student)
|
|
|
|
|
DanYELL wrote: I havent created the final app yet. In the end, I hope its in
MFC.
OK, when you create your app, you can choose printing support from the wizard, this gives you the framework you need to do printing, and there's heaps of info online about using it.
DanYELL wrote: However, the bigger and more complicated the bitmap, the slower it
takes to print and I need big (lots of pixels) bitmaps to include
all the detail of the form. I cant figure out how to change
Stringer's printing class library to print some other image format like a tiff. If I could modify that code to print a tiff (and a
bitmap) that could overlay text, then it might print faster and
Id be happy.
Some printers will let you send a tiff, but I don't know how many. If you want to draw on the bitmap, then it needs to be a bmp in memory. I really don't know how to stream a tiff to a printer, although obviously the first step would be reading it as a byte stream.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Anybody knows how to get SPDRP_FRIENDLYNAME in SetupDiGetDeviceRegistryProperty from USB disk, the buffer I get always invalid?In addition Can It works under Win98?
DEFINE_GUID(GUID_CLASS_USB_DEVICE,
0xA5DCBF10, 0x6530, 0x11D2, 0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9, 0x51, 0xED);
hDevInfo = SetupDiGetClassDevs((LPGUID)&GUID_CLASS_USB_DEVICE,
0, 0, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
if (hDevInfo == INVALID_HANDLE_VALUE)
return false;
DeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
for (i = 0 ; SetupDiEnumDeviceInfo(hDevInfo, i, &DeviceInfoData) ; i++)
{
DWORD DataT;
LPTSTR buffer = new char[1024];
DWORD buffersize = 1024;
SetupDiEnumDeviceInterfaces (hDevInfo, 0, &DeviceInfoData.ClassGuid, i, &DInfoData);
while (!SetupDiGetDeviceRegistryProperty(hDevInfo, &DeviceInfoData,
SPDRP_FRIENDLYNAME, &DataT, (PBYTE)buffer, buffersize, &buffersize))
...
}
|
|
|
|
|
Hello,
I'm writing an application that uses MFC.
It is a kind of media player and I use CListCtrl to display playlist.
But I get a strange error when I add items to my list control. After the 17th item added, my app crashs with a message box showing "Invalid Hook Descriptor".
I am attaching some code. To keep it simple, I've just extracted parts liable to contain the bad code : the overrided Create member method and the UpdateList method.
An explanation : I'm displaying playlist. So I read the M3U file and I call Update list method to add the file paths to the CListCtrl.
Any help would be appreciated. That bug is driving me crazy.
Thanks
bool CMusicBox::CreateWnd(CWnd* Parent)<br />
{<br />
parent = Parent;<br />
if(parent)<br />
{<br />
<br />
RECT client;<br />
parent->GetClientRect(&client);<br />
int result = this->Create(WS_CHILD|WS_VSCROLL|WS_BORDER|WS_VISIBLE|LVS_SHOWSELALWAYS|LVS_REPORT|LVS_ALIGNLEFT,client,parent,1234);<br />
this->SetExtendedStyle(0x00004000|0x00000100|0x00000020|0x00000010);<br />
<br />
this->SetBkColor(RGB(237,242,249));<br />
}<br />
The UpdateList method
void CMusicBox::UpdateList(void)<br />
{<br />
this->DeleteAllItems();<br />
ASSERT(this->GetItemCount() == 0);<br />
int max = this->play.playList.GetCount();<br />
<br />
this->SetItemCount(max);<br />
<br />
int i = 0;<br />
<br />
for(i = 0;i<max;i++)<br />
{<br />
CFile myFile;<br />
<br />
CString title;
CString path;<br />
unsigned long siz = 0;<br />
<br />
if(myFile.Open(this->play.GetSong(i),CFile::modeRead|CFile::shareDenyNone))<br />
{<br />
title = myFile.GetFileTitle();<br />
siz = myFile.GetLength();<br />
myFile.Close();<br />
}<br />
else {<br />
title.Format("Access Denied");<br />
}<br />
HMS dure = {0,0,0};<br />
<br />
path = CString(this->play.GetSong(i));<br />
<br />
HWND tester = MCIWndCreate(NULL,AfxGetInstanceHandle(),WS_BORDER|MCIWNDF_NOERRORDLG,path.GetString());<br />
if(tester)<br />
{<br />
long len = MCIWndGetLength(tester);<br />
dure = GetHMSTime(len);<br />
MCIWndDestroy(tester);<br />
}<br />
<br />
char *taille = new char[50];<br />
char *duree = new char[50];<br />
char *chemin = new char[MAX_PATH];<br />
char *titre = new char[MAX_PATH];<br />
<br />
sprintf(taille,"%.2f",siz/(1024.0*1024));<br />
if(dure.h == 0) <br />
sprintf(duree,"%d : %02d", dure.m, dure.s);<br />
else sprintf(duree,"%d : %02d : %02d",dure.h, dure.m, dure.s);<br />
strcpy(chemin, path.GetString() );<br />
<br />
CPath filePath(path);<br />
<br />
sprintf(titre,"%s",filePath.GetTitle());<br />
<br />
LVITEM lvi;<br />
<br />
ZeroMemory(&lvi,sizeof(LVITEM));<br />
<br />
lvi.mask = LVIF_TEXT;<br />
<br />
this->InsertItem(i,"item");<br />
<br />
this->SetItem(i,0,LVIF_TEXT,titre,NULL,NULL,NULL,NULL);<br />
this->SetItem(i,1,LVIF_TEXT,duree,NULL,NULL,NULL,NULL);<br />
this->SetItem(i,2,LVIF_TEXT,chemin,NULL,NULL,NULL,NULL);<br />
this->SetItem(i,3,LVIF_TEXT,taille,NULL,NULL,NULL,NULL);<br />
<br />
<br />
}<br />
}<br />
-- modified at 21:05 Saturday 29th October, 2005
|
|
|
|
|
hi,
beginner question: how would I implement a "number picker" control where there is an up/down button (like from a vertical scrollbar) and as you click up the number increments by one, down decrements by one until it hits zero, then when I hit ok it gives me the number I chose. Thanks!
|
|
|
|
|
Look up Up-Down Controls in MSDN. (The CSpinButtonCtrl class if you're using MFC.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Thanks, that worked! One question, the up arrow makes the numbers decrease, and the down arrow makes them increase. Any way to reverse that? Thanks again!
|
|
|
|
|
That's the default behavior. You have to manualy set the range, direction and all that. You can even set an acceleration--how it goes slow at first then speeds up. You can also set whether to insert a thousands separator if appropriate.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
i have a struct array:
typedef struct _PERSON
{
TCHAR *firstName;
TCHAR *lastName;
TCHAR *address;
TCHAR *phone;
} PERSON;
which a properly alloc in annn array of people[10]
then i call:
myAddressBook *book = new myAddressBook(_T("first"),_T("slast"),_T("phone"),_T("add"));
book->addPerson(_T("first"),_T("aaaaa"),_T("phone"),_T("add"));
book->addPerson(_T("first"),_T("bbbbb"),_T("phone"),_T("add"));
book->addPerson(_T("first"),_T("ddddd"),_T("phone"),_T("add"));
book->addPerson(_T("first"),_T("ccccc"),_T("phone"),_T("add"));
book->sortPeople(book->people,book->mTotal);
heres the func:
void myAddressBook::sortPeople(PERSON *per, int num)
{
PERSON *temp;
for (int x=0;x<(mTotal-1); x++)
{
if (_tcsncmp(per[x].lastName, per[x+1].lastName, _tcslen(per[x].lastName)) > 0)
{
//str2 is biggerr, so- swap em
temp = &per[x];
per[x] = per[x+1];
per[x+1] = *temp;
}
}
}
the results are not right, duplicated entries and other oddness, whats wrong?
|
|
|
|
|
kerrywes wrote: per[x+1] = *temp;
that doesn't seem right.
shouldn't it be "per[x+1]=temp;"
i assume per is an array of pointers to PERSONs
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
The fault is with the the copy routines.
temp = &per[x] gets just a pointer but then per[x] = per[x+1] does a copy, destroying the original data. You need to force copies for each of the swap operations. You also need to make temp a value, not a pointer.
temp = per[x];
per[x] = per[x+1];
per[x+1] = temp;
Ultimately, this realy doesn't do a sort, though. It just does a single pass through the array. Look up bubble sort to learn how to do a very basic sort.
(Generally, using qsort, or some version thereof, would be better.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
1. kerrywes wrote: {
2. //str2 is biggerr, so- swap em
3. temp = &per[x];
4. per[x] = per[x+1];
5. per[x+1] = *temp;
6. }
Hi
In 3 you save the address of per[x] but replace the content of that !
must change to
{<br />
*temp = per[x];<br />
per[x] = per[x+1];<br />
per[x+1] = *temp;<br />
}
but in this case you have a problem that the temp is pointer, you most declere it as
PERSON temp;
Iman Ghasrfakhri
-- modified at 1:12 Sunday 30th October, 2005
|
|
|
|
|
hi everybody , ive used the code published here( named w3client) to connect to hotmail and tried to login to ,but it dosent work. can anyone help please ?
url="https://login.passport.com";
_pclient->Request("/ppsecure/post.srf", W3Client::reqPost);
_pclient->AddPostArgument("login","MyLogin");
_pclient->AddPostArgument("passwd","MyPassword");
_pclient->AddPostArgument("id","2");
_pclient->AddPostArgument("svc","mail");
_pclient->AddPostArgument("msppjph","1");
_pclient->AddPostArgument("tw","0");
_pclient->AddPostArgument("fs","1");
_pclient->AddPostArgument("fsa","1");
_pclient->AddPostArgument("fsat","1296000");
_pclient->AddPostArgument("lc","1033");
_pclient->AddPostArgument("_lang","EN");
_pclient->AddPostArgument("bk","1130609581");
_pclient->AddPostArgument("SI","++++Sign+In++++");
_pclient->Request("/ppsecure/post.srf", W3Client::reqPost);
the hotmail html code for the form looks like that :
// method="post" action = "..
//https://login.passport.com/ppsecure/post.srf?id=2&svc=mail&msppjph=1
//&tw=0&fs=1&fsa=1&fsat=1296000&lc=1033&_lang=EN&bk=1130606198
|
|
|
|
|