|
forgot to mention that when I look at this field through enterprise manager it's missing the 0x00 and 0x04.
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
HI all,
When creating an MFC (SDI / MDI). How do I get the app (EXE file) to display an icon of my choice in the directory area, instead of the annoying default IDR_MAINFRAME? Also, the with associated document, should I decided to serialise them.
Your guruship is most welcome.
Alton
|
|
|
|
|
Edit the two default icons presented in the Resources tab.
There should already be one for the EXE and another for the document.
If you want them to be different for some reason, then add additional icons to the resources and track down where they are loaded and assigned. Override those functions to return the icons of your choosing loaded from the resources.
|
|
|
|
|
Tried that, It works for the frame when app is up and running.
I've also rename say IDI_ICON1 to IDR_MAINFRAME and puts up a stubborn resistance.
Thanks, Blake anyway.
Alton
|
|
|
|
|
|
The easiest way to do this is to simply replace the two .ico files.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
How do you set a checkbox to checked on program startup?
IDC_CHECK SetCheck(IDC_CHECK) doesn't seem to work. Do I need a handle to the checkbox???
THX
|
|
|
|
|
Yes, or else use this:
HWND hWndControl = GetDlgItem(this->m_hWnd, IDC_CHECK);<br />
SendMessage(hWndControl, IDC_CHECK, BM_SETCHECK, wParam, BST_CHECKED, 0);
|
|
|
|
|
Blaine,
Thank you for taking the time to answer this simple question. When I tried to implement your suggestion I got this ...
4030R TestingDlg.cpp
C:\CCViews\ggerber_view\cmd_proc\4030R Hemi Test\4030R TestingDlg.cpp(123) : error C2664: 'void __thiscall CWnd::GetDlgItem(int,struct HWND__ ** ) const' : cannot convert parameter 1 from 'struct HWND__ *' to 'int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
C:\CCViews\ggerber_view\cmd_proc\4030R Hemi Test\4030R TestingDlg.cpp(124) : error C2065: 'wParam' : undeclared identifier
Error executing cl.exe.
Here is my OnInitDialog Function Code ...
BOOL C4030RDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, true); // Set big icon
SetIcon(m_hIcon, false); // Set small icon
// TODO: Add extra initialization here
hDlgWnd = GetSafeHwnd();
THREADINFO* ptp = new THREADINFO;
ptp->hWnd = hDlgWnd;
g_pThread = AfxBeginThread(ThreadPanelRead, ptp, THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED);
// Creates a 12-point-Courier-font
m_Font.CreatePointFont(120, _T("Arial Bold"));
// Set Font without a member variable
GetDlgItem(IDC_EDIT_L5)->SetFont(&m_Font);
GetDlgItem(IDC_EDIT_L4)->SetFont(&m_Font);
GetDlgItem(IDC_EDIT_L3)->SetFont(&m_Font);
GetDlgItem(IDC_EDIT_L2)->SetFont(&m_Font);
GetDlgItem(IDC_EDIT_L1)->SetFont(&m_Font);
GetDlgItem(IDC_EDIT_R5)->SetFont(&m_Font);
GetDlgItem(IDC_EDIT_R4)->SetFont(&m_Font);
GetDlgItem(IDC_EDIT_R3)->SetFont(&m_Font);
GetDlgItem(IDC_EDIT_R2)->SetFont(&m_Font);
GetDlgItem(IDC_EDIT_R1)->SetFont(&m_Font);
GetDlgItem(IDC_STATUS)->SetFont(&m_Font);
GetDlgItem(IDC_TRIG_MODE)->SetFont(&m_Font);
HWND hWndControl = GetDlgItem(this->m_hWnd, IDC_CHECK1);
SendMessage(hWndControl, IDC_CHECK1, BM_SETCHECK, wParam, BST_CHECKED, 0);
g_bContAquire = false;
g_nTriggerSource = UNKNOWN_TRIGGER;
return true; // return true unless you set the focus to a control
}
I hope this helps and again thanks for helping out a newbie ...
Greg
|
|
|
|
|
I forgot that GetDlgItem is also a member function of CDialog.
Same goes for SendMessage.
Okay, so give it global scope - notice two semi-colon in front of function names.
Sorry
HWND hWndControl = ::GetDlgItem(this->m_hWnd, IDC_CHECK1);<br />
::SendMessage(hWndControl, IDC_CHECK1, BM_SETCHECK, BST_CHECKED, 0);
See also other responses, which might be preferable in your situation, since most of the rest of your code is MFC.
Also, the m_hWnd of a dialog is valid during the OnInitDialog, certainly after the base class has been called, so you can probably reduce to this:
THREADINFO* ptp = new THREADINFO;<br />
ptp->hWnd = m_hWnd;<br />
g_pThread = AfxBeginThread(ThreadPanelRead, ptp, THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED);
|
|
|
|
|
m_myCheckBox.SetCheck (BST_CHECKED);
CheckDlgButton (IDC_MY_CHECKBOX, BST_CHECKED); /ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Thanks for all your time and help ...
Greg
|
|
|
|
|
Simple, there's two ways to do it:
- The first way is to use the GetDlgItem(control's ID)
cast it to a pointer to a type CButton as viz:
<br />
CButton *pCheck = reinterpret_cast<CButton *>(GetDlgItem(IDC_CHECK1));<br />
pCheck->SetCheck(TRUE);<br />
of:
- Using Class Wizard (or maunally), map the check box to a "Control" category variable of type CButton (default)
bot in your dialog's header file
<br />
enum { IDD = IDD_CHECK_DIALOG };<br />
CButton m_check;<br />
and in the DoDataExchange method
<br />
<br />
void CCheckDlg::DoDataExchange(CDataExchange* pDX)<br />
{<br />
CDialog::DoDataExchange(pDX);<br />
DDX_Control(pDX, IDC_CHECK1, m_check);<br />
}<br />
have been added (or you have to insert DDX_Control(pDX, IDC_CHECK1, m_check); if done manuallY)
the code in OnInitDialog is such:
<br />
m_check.SetCheck(TRUE);<br />
Happy programming,
Alton
|
|
|
|
|
Thanks for all your time and help ...
Greg
|
|
|
|
|
Alton Williams wrote:
m_check.SetCheck(TRUE);
Even though TRUE and BST_CHECKED resolve to the same value, this method of using SetCheck() is not recommended.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi,
I want to make a playlist editor for my MP3 player. I've upped the playlist file to my server. You can download it here:
www.tommy2d.com/MyFavorite.plp
I can open it with notepad without any problems. However, when i save it to UNICODE LE, UNICODEBE or whatever format Notepad support, i can't load aymore on my MP3 player...
Could anybody please indicate what type of file this is and how to open it in C++?
Thnx...
|
|
|
|
|
I know that format from Samsung players. The player expects the file to be little-endian UTF-16 with no byte order mark. When you save the file with Notepad, it adds the BOM, so you'll need to remove it before putting the file on the player.
--Mike--
LINKS~! Ericahist updated! | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
Ok, thanks for this information ...But how do i go writing a program that is capable of reading and writing such files? At the moment, I'm using the CTextFileRead class found on this site. But this class is not capable of reading UTF16 files I believe...
|
|
|
|
|
|
Hi,
I just the following code but it just reads the first char and then it quits on my poor textfile. This is the same thing as what happened when i used the class. The size it determines is correct however.
Please help me on this. I don't have any exp with anything else then just plain char arrays I really don't know what to do next.
<br />
#include <iostream><br />
#include <fstream><br />
#include <stdlib.h><br />
#include <windows.h><br />
using namespace std;<br />
<br />
const char * filename = "J:\\MyJukeBox\\PLAYLIST\\MyFavorite.plp";<br />
<br />
int main () {<br />
wchar_t * buffer;<br />
long size;<br />
wfstream file (filename, ios::in|ios::ate);<br />
size = file.tellg();<br />
file.seekg (0, ios::beg);<br />
buffer = new wchar_t [size];<br />
file.read (buffer, size);<br />
file.close();<br />
<br />
cout << "the complete file is in a buffer. Size:" << size;<br />
MessageBox(0,buffer,NULL,0);<br />
<br />
delete[] buffer;<br />
<br />
return 0;<br />
}<br />
|
|
|
|
|
Is the problem with reading the file or displaying it in your messagebox?
The first thing I would suggest is to use debugger to check if
file.read (buffer, size);
actually reads the file into buffer (break after this line and look at buffer.)
If buffer does not contain the correct contents, the problem is with reading. Maybe the read is expecting 8-bit ASCI?
If buffer actually has the ciorrect contents, the problem may be that
MessageBox(0,buffer,NULL,0);
expects buffer to be ASCI text, so if it is contains a 0x00 byte, this is seen as end of string.
|
|
|
|
|
The problem is with the reading, but i already knew that. I just really don't know how to read this file...The format was UTF16 without the last byte...
|
|
|
|
|
Hi,
I want to make a playlist editor for my MP3 player. I've upped the playlist file to my server. You can download it here:
www.tommy2k.com/MyFavorite.plp
I can open it with notepad without any problems. However, when i save it to UNICODE LE, UNICODEBE or whatever format Notepad support, i can't load aymore on my MP3 player...
Could anybody please indicate what type of file this is and how to open it in C++?
Thnx...
|
|
|
|
|
Dear all,
I have a program which, when active, sits in the taskbar. So long as the progam is open I want to add a button next to the min/max/close buttons on all open windows (operating system windows xp). Does anyone know where I can find example code where this is being done... I have searched through the code project website but haven't been able to locate anything of this nature and would be really grateful if someone could give me some help.
Thanks
Andrew
|
|
|
|
|
Hi, I need to delete a file.
When i do :
if( remove( tpath ) == -1 ) perror( "Could not delete file" );
else printf( "Deleted\n" );
I get : access denied, I know this is because the file is still open but for personal reasons I can't close it, I just need to delete it
So this file really needs to be destroyed, is there a way to force the deletion ??
|
|
|
|