|
Hi
I designed a Toolbar class which is derived from CToolBar. The "AddButton" can not load bitmap for the buttons.
bool CMyToolbar::AddButton(int nIndex, UINT Cmd, UINT BitmapResId)
{
TBBUTTON tb;
tb.idCommand = Cmd;
tb.fsState = TBSTATE_ENABLED;
tb.fsStyle = TBSTYLE_BUTTON;
tb.dwData = 0;
tb.iString = NULL;
GetToolBarCtrl().InsertButton (nIndex, &tb);
GetToolBarCtrl().LoadImages(BitmapResId, AfxGetInstanceHandle());
return true;
}
Can you help to locate the BUG?
Best regards,
|
|
|
|
|
You probably need to set tb.iBitmap .
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
i want to create MFC based project in visual studio c++ 2005 and want to run and see my window(such as add buttons, sample text boxes, and other control objects) that i have write code.
plz help me. i want to create MFC based project and run..........
|
|
|
|
|
Try Wizard(File - New - Project)
|
|
|
|
|
As the other one suggested, using the wizard is a good start.
I suggest you use google to find a good beginner's tutorial; or use your local public library (or book store) to find a beginner MFC book.
This signature was proudly tested on animals.
|
|
|
|
|
In Visual Studio 2005:
Click File->New->Project
In the wizard under the visual C++ label you should have "MFC", then on the right side select the most suitable project type you need.
When the wizard is finished hit F5 to compile and run your the test application Visual Studio generated for you. There should be buttons and sample text i believe.
RM
|
|
|
|
|
13 essential skill in vc++ by steven holzner
is a good book for starters
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
|
Maybe he's just a retard.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: Maybe he's just a retard.
FTFY
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
you asked before, and got several answers which seemed to be good starting points. I personally defended you from some of those who despaired at your original post. we should be helpful to those trying to learn, I felt.
but you didn't reply to those answers and have just posted essentially the same question again.
So - did you not bother to read those answers? did you not understand them?
If you don't even TRY to help yourself, you're going to find it pretty hard to get help from anyone - and I think you have already outstayed your welcome on CP
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
Hay,
I looking for open source code in c language which schedule/deschdule a functions that will run in a new threads, so for example I can schedule the function to run every 30 minutes in new tread.
I want to use this source in my program as an infrastructure service.
I prefer using a source which will compiled on Linux and Windows platforms.
Please, any help - link
|
|
|
|
|
You mean code to create a thread?
just use
DownlinkThread = CreateThread(
NULL, // default security attributes
0, // use default stack size
Func, // thread function
0, // argument to thread function
0, // use default creation flags
&MsgThreadId); // thread identifier
The thread function is
WORD WINAPI Func( LPVOID lpParam )
{
while(1)
{
Sleep(30 * 60 * 1000);
}
return(0);
}
Substitute CreateThread with pthread_create and Sleep with uSleep for the Linux version
|
|
|
|
|
I know how to di it, I looking for more complicated thread events infrastructure which I can schedule to promise order and timing of events.
What aboute to schdule event to run (every 30 seconds, or to kill all created threads in one time.
I looking for the source of it as part of sharing code via the internet, and also learn new ideas.
BTW I found till now the "cheap thread" - a library of portable C routines to implement cooperative multitasking with prioritized scheduling, but they actully not using thread creation.
Any other links?
|
|
|
|
|
I created an MFC application and added Printing and Print Preview capability to a CMyFormView derived from CFormView. The problem I have is
that the "Prev Page" and "Zoom Out" buttons on the Print Preview toolbar are
always disabled. The "Two Pages" button and "Next Page" are enabled and work
correctly.
For the Prev Page button, I set CPrintInfo::SetMaxPage() and CPrintInfo::SetMinPage(). However, this doesnt work to enable the Prev Page button. In debug mode, I could see that CPrintInfo::m_nCurPage value was corrent within OnPrint() method when the program is in print preview. Anybody knows how to enable Prev Page button in Print Preview dialog?
Thanks
Sheng
|
|
|
|
|
I have to have a list of choices in a text menu for a console app in C. The text menu is to be populated from strings read from an INI file.
Anyone ever done anything like this?
For example:
[Model-A]
1="XYZ, Location = ABC"
2="GHI, Location = DEF"
I want to read the section then populate some strings based on the number of keys read. The string then is parsed using the string delimiter.
Appreciate the help.
Jer 29:11
|
|
|
|
|
Well, if you're doing any of this in C++, CodeProject has quite a few good examples[^] to get you started. Otherwise, I'm sure someone[^] has come up with a solution
Adam Maras | Software Developer
Microsoft Certified Professional Developer
|
|
|
|
|
I do have an IniFile Class but the majority of code is ANSI C. I have an INI file that is read and choice are presented to the user with a static text menu. If the INI file changes (grows) then I have to rev. code. I would rather rev. the INI file.
Jer 29:11
|
|
|
|
|
|
Choice 'C' but not using C# which the link in choice 'B' is based upon.
Jer 29:11
|
|
|
|
|
Google the GetPrivateProfileString API to help read from an INI file. Once you have the values you can create the menu using regular STDOUT and STDIN routines such as printf , scanf , getchar , gets et al.
|
|
|
|
|
I want to put a Login form at the beginning of my project with using VC++ MFC along with validations.I have created a table using MS-ACCESS giving Username and Password as column headers.Now I want to connect the MS-ACCESS table contents with this VC++ MFC form.So if I enter the name and password in the edit boxes which are in the Login form,it should check that particular data whatever is typed in the edit boxes with the records in the MS-ACCESS say in login.mdb and pop a messagebox if it is incorrect,else the user must be allowed to enter the next form.S how to do that.The same thing I have done in Visual Basic as follows,but now I want the equivalent code in VC++ MFC,can anyone pls tell me...?
Private Sub cmdOk_Click()
Dim cnt As Integer
adLogin.Recordset.MoveFirst
cnt = 1
If txtLogin = "" Or txtPassword = "" Then
MsgBox "Invalid UserName or Password"
Exit Sub
End If
While Not adLogin.Recordset.EOF
If adLogin.Recordset(0) = txtLogin.Text And adLogin.Recordset(1) = txtPassword.Text Then
Unload Me
'mainForm.Show
frmOption.Show
Exit Sub
Else
adLogin.Recordset.MoveNext
cnt = cnt + 1
End If
Wend
If cnt >= adLogin.Recordset.RecordCount Then
txtLogin.Text = ""
txtPassword.Text = ""
MsgBox "Wrong User Name or Password"
txtLogin.SetFocus
End If
End Sub
|
|
|
|
|
hello,
i want to start and stop other process (win32 vc++ application without gui) in a mfc dialog application. please tell me how to do that ?
for stopping, i read that TerminateProcess() can be used but it should be used in extreme circumstances. The state of global data maintained by dynamic-link libraries (DLLs) may be compromised if TerminateProcess is used. so is it safe to use it ??
|
|
|
|
|
Hello,
rahuljin wrote: want to start and stop other process (win32 vc++ application without gui)
What kind of an application are you developing?
You can use ShellExecute[^] to create a process. Or if you want more options and possibly control over the spawned process, there is CreateProcess[^]
No, you shouldn't be using TerminateProcess(), but again if you say what kind of application are you writing (and if you have written the spawned process as well), a better alternative might be suggested to you.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
mfc application creates some text files which are used by other win32 c++ program. if i try to access the files through mfc application while win32 c++ program running, it causes the crash of the mfc application (beacuse i dont used any 'if' for file open and i cant).
i used the createprocess() and it is working great.
|
|
|
|