|
Nothing realy.....
they are just simple dialog resources.
only thing changed is the Child / Popup styles
|
|
|
|
|
Hi!
I work with database from MFC (Access).I want to send Sql command.
My function recieve parameter and I use variable type CString with format.
For example:
strSql.Format("SELECT COUNT([TblCatalogList].[CatalogId]) FROM [TblCatalogList] WHERE [TblCatalogList].[PcBoard] LIKE '%s%'",strBoard);
But it does not work and failed becouse unknown format.LIKE must have this format,for example
LIKE '123%' it means that I want to find string that begin from 123,but how must I write if I have a parameter???
Help me,please with syntax!!!
|
|
|
|
|
What does strSql contain after the format statement? I suspect from the example you gave that you'll be missing a percentage and quote sign. This is because the two characters "%'" will be removed from your string. To get a '%' character in a string you need to put two of them (%%):
strSql.Format("SELECT COUNT([TblCatalogList].[CatalogId]) FROM [TblCatalogList] WHERE [TblCatalogList].[PcBoard] LIKE '%s%%'",strBoard);
Hope this helps.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
To get a literal % sign you'll need to specify it as %% in the format string.
You know, for kids!
|
|
|
|
|
Hi.
I would like to enable and disable one or more toolbar *buttons*. According to what Prosise mentioned, it can be done using the Enable() that the framework passes to a menu/toolbar update message handler. However, I am not quite clear on how to disable a specific toolbar button. For example, let say I have a toolbar with five buttons.
[button1][button2][button3][button4][button5]
How would I enable/disable, say, button2?
Thanks,
Kuphryn
|
|
|
|
|
When you create each button in the toolbar, it should have an associated command ID. These IDs are passed in as an array in the CToolBar::SetButtons() command. If you create a toolbar in the resource editor (this is from memory, I don't normally do it this way) I think you just select one of the buttons on your toolbar and bring up the properties, then add a command ID there.
Anyway, this ID is the command ID used in the ON_UPDATE_COMMAND_UI update handler (ie you have one handler per toolbar button, not for the toolbar as a whole). If you have a range of toolbar buttons and you don't want to write code for all of them, you can also use ON_UPDATE_COMMAND_UI_RANGE.
So, in summary, each Update Command handler should apply to a single toolbar button.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
Okay. Thanks.
I am uncertain one something. Here is what I am trying to do. When the application first starts, I want to disable one or more buttons. When the user select a certain option via menu, then the program would enable the button. I need a way to get a hold of a pointer to the toolbar right when the application starts up so I can disable one or more buttons. It can be done with commandUI and commandUI_RANGE, but how about any other arbitrary time?
Kuphryn
|
|
|
|
|
Well, you can put your command handler anywhere that message are received. The best place to put them in this case would probably be the CFrameWnd-derived class where you create the toolbar. The same class would also have a handler for the menu item. For example, if the menu item is ID_ALLOW_BUTTON and the button itself is ID_MY_BUTTON:
In the header:
bool m_bButtonAllowed;
afx_msg void OnAllowButtonMenu();
afx_msg void OnUpdateMyButton(CCmdUI *pCmdUI);
afx_msg void OnMyButton();
In your constructor:
m_bButtonAllowed = false;
In the message map:
ON_COMMAND(ID_ALLOW_BUTTON, OnAllowButtonMenu)
ON_UPDATE_COMMAND_UI(ID_MY_BUTTON, OnUpdateMyButton)
ON_COMMAND(ID_MY_BUTTON, OnMyButton)
Then:
CMainFrame::OnAllowButtonMenu()
{
m_bButtonAllowed = true;
}
CMainFrame::OnUpdateMyButton(CCmdUI *pCmdUI)
{
pCmdUI->Enable(m_bButtonAllowed ? 1 : 0);
}
CMainFrame::OnMyButton()
{
AfxMessageBox("Got me!");
}
Hope this helps.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
Thanks. That is exactly what I thought of.
Just one more thing: should I map the command UI update in the MainFrm or the view? I am working with doc/view architecture.
Kuphryn
|
|
|
|
|
Aaah, that old chestnut! It really depends on what the toolbar button does. If the operation of the button could apply to more than one view type (for example, the program I'm working on has ten doc/view types, and some buttons apply to all, while others apply to only one) then it probably makes more sense to put it in MainFrame. If the button only really applies to one view type, it's probably going to be easier to update in the view, otherwise you're going to need to do something like:
void CMainFrame::MyUpdateHandle(CCMdUI *pCmdUI)
{
pCmdUI->Enable(FALSE);
CFrameWnd *vpFrame = GetActiveFrame();
if (vpFrame != NULL)
{
CView *vpView = vpFrame->GetActiveView();
if (vpView != NULL)
{
if (vpView->IsKindOf(RUNTIME_CLASS(CMyButtonView)))
{
CMyButtonView *vpMyView = static_cast<CMyButtonView *>vpView;
if (vpMyView->ShouldIEnableTheButton())
{
pCmdUI->Enable(TRUE);
}
}
}
}
} Whew! As opposed to:
CMyButtonView::OnUpdateButton(CCmdUI *pCmdUI)
{
pCmdUI->Enable(ShouldIEnableTheButton());
}
So, all in all, it's really a style/ease of programming kind of question. I'll leave that decision up to you...
Hope this helps.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
Good point! Thanks.
I will stick with the simple code for now since all m views use the same toolbar.
Kuphryn
|
|
|
|
|
Could anyone suggest a book(s) that covers the printing process for VC6 comprehensively or even adequately?
Maybe I'm looking in the wrong section but most books seem to touch on the subject and quickly move on.
Any advice is appreciated.
|
|
|
|
|
I haven't found any books that cover printing from Windows application very well. I think the 'best' printing solutions may have a lot to do with what you are trying to accomplish.
For starters you could look at these articles here at The Code Project:
A Simple Printing Mechanism
Easy! Reports
Very Simple Print Preview without the Doc/View architecture
|
|
|
|
|
I want to receive notify messages when data comes using UDP Sockets.
Can I do this?
I can only use UDP and I don't want the socket to be in blocking mode.
Besides polling, is there any better way to check whether there is data waiting to be received?
|
|
|
|
|
Use CAsyncSocket. Just what you're looking for.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Oops. Maybe you're not using MFC. If not, you'll have to use the FDZERO / FDSET etc... Macros. Their described in the sockets ref on MFC.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
I want to get the keycode when the user press a key immediately.
Normally I can open a thread and use getc(stdin), but this works only when the
user press a key and then press 'Enter'.
I want to get the key without pressing 'Enter'.
Can and how can I do this?
|
|
|
|
|
Here's an example from MSDN
#include <stdio.h>
#include <conio.h>
void main(void)
{
int ch, scan;
do {
ch = getch(); /* 1st getch() gets ASCII code */
printf("Character is %d\n", ch);
if (ch == 0x00 || ch == 0XE0) { /* if extended key */
scan = getch(); /* 2nd getch() gets "scan code" */
printf("\tExtended character: scan is %d\n", scan);
}
} while (ch != 27); /* exit loop on ESC */
}
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- <b>Jon Hulatt, 22/3/2002</b>
|
|
|
|
|
Thanks a lot!
|
|
|
|
|
eg. I want to play a MPEG file in a remote computer.
Thank you very much!
|
|
|
|
|
Do you want to start the MPEG file playing on the remote computer, Or do you want to access the file on the remote computer, and play it on your machine.
Checkout my Guide to Win32 Paint for Intermediates
|
|
|
|
|
yes,I want to play a MPEG on my machine,but it be stored on another computer.
If i might do, it must to been have a source filter to read a remote file,isn't it? or other way? Who Could tell me?
Thank you. excuse me,my English is poor.
|
|
|
|
|
I am still trying to get some code working using Text Object Modeling.
So far it has been like pulling teeth!
Does anyone know where I can find tom.h?
How about a declaration of ITextRange?
UUGHH!!!
|
|
|
|
|
When using Microsoft tools, msdn.microsoft.com should be your first port of call. A search for ITextRange quickly told me that ITextRange requires Windows 98 or later, and that fact combined with the fact that obviously you don't have the file leads me to conclude there is either a Text Object Model SDK or, more likely, this stuff is in the platform SDK. you should check to make sure, but I think it's the PSDK you need to download or order on CD and install before you continue.
Dave_ wrote:
Does anyone know where I can find tom.h?
People often seem to think because they need to include a header file, that if only they HAD that header file, all would be OK. When you're dealing with something bigger than a single class, this is NEVER the case. tom.h is probably just a block of include statements which groups together all the headers needed to access the classes/macros/namespaces/etc used by the Text Object Model.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
Of course I don't believe that having tom.h would be the final solution to getting Text Object Modeling. What I am looking for is a place to go to get started using TOM. MSDN does a good job of explaining the details of how the interfaces work, and what you can do with them, but fails to give an explanation of how to get started using this technology. Locating tom.h (and other supporting files) would be a clue to get me headed in this direction.
It is apparent that there are not many people out there using this technology. If I am able to gain a better understanding, I will share it with other CodeProject users.
Thank you for your reply. I will check into the SDK CD(s).
|
|
|
|