|
CHris is correct, the standard SQL delimiter for ' is to double it up with ''.
However, a better way (if you're using the COM ADO interface) would be to write stored procedures and use ADODB.Command. With a proc you don't need to delimit anything, and you SQL will run much quicker with a smaller footprint, becuase procedures are compiled only once, not at query execution.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Hi All,
For those who are interested in P2P, Web Services, distributed network computing, there is an alternative pure Java based Distributed Network Computing platform. The software is downloadable at www.GreenTeaTech.com.
Chris
|
|
|
|
|
Hi All,
I'm not having a problem so much as getting a warning that I know why I'm getting, but dont want to get so I want to know if there is a better way of doing it? If that makes any sense!
What I have is a number that is 16bits in size, ie 0xFFFF is its biggest size! Trouble is I want it to be in a loop that breaks when its > FFFF which would be 0x10000, so I make it a 32bit (DWORD) number to accomplish this!
In my loop however I need to split up the lowest 16 bits into two 8 bit numbers. So if I have WORD Address = 0xFF9B; I want UCHAR Address1 = 0xFF and UCHAR Address2 = 0x9b;
I'm getting my 8 bit values with the following:
Address1 = (Address & 0xFF00)/0x100;
Address2 = (Address & 0xFF);
which works ok but each time i compile it obviously warns me I'm possibly loosing data from the DWORD address. I know the data I'm loosing is just the Most significant 16 bytes of the Address value which will always be 0x0000 so I dont care if I loose that.
My question is how do I stop the compiler warning me about this or is there a better way of doing what I need to do anyway?
|
|
|
|
|
Nevermind, I found using BYTE and LONG instead of UCHAR and DWORD it doesnt throw the warning!
|
|
|
|
|
Just use a cast:
Address1 = (UCHAR)(Address & 0xFF00)/0x100;
Address2 = (UCHAR)(Address & 0xFF);
Sometimes i only remember, The days when i was young Nowadays no one remembers when they were young and stupid... ADEMA, The Way You Like It
|
|
|
|
|
Does anyone know how to supress the ability for the items in a listctrl to become highlighted?
|
|
|
|
|
You'll need to use custom draw and draw the selected items in the normal colors. See my custom draw article in the List Controls section here on CP for more info.
--Mike--
"Jobs that don't allow you to visit the Lounge 25 times a day at the minimum are not worth having anyway."
-- Nish, 3/28/2002
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan and Jamie Salé.
|
|
|
|
|
Can anyone give me any clues as to what WM_AFXFIRST - WM_AFXLAST messages are used for. I've searched all of the VC/MFC Source Code, MSDEV etc. and can't find anything.
I have a problem where the main thread is getting a WM_AFXFIRST+3 for a Window in another thread (in my app) which is causing an ASSERT and crash because the Window isn't in the main thread's map.
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
WM_AFXFIRST and WM_AFXLAST are #define ed in winuser.h. The individual messages are #define ed in afxpriv.h - WM_AFXFIRST = WM_IDLEUPDATECMDUI .
Interestingly, i cannot find WM_AFXFIRST/WM_AFXLAST mentioned in MSDN, although the actual range (0x0360 - 0x037F) is documented along with many of the messages themselves.
Sometimes i only remember, The days when i was young Nowadays no one remembers when they were young and stupid... ADEMA, The Way You Like It
|
|
|
|
|
Shog9 wrote:
WM_AFXFIRST and WM_AFXLAST are #defineed in winuser.h.
Yes I found them there, but I couldn't find them being actually used anywhere.
Shog9 wrote:
Interestingly, i cannot find WM_AFXFIRST/WM_AFXLAST mentioned in MSDN, although the actual range (0x0360 - 0x037F) is documented along with many of the messages themselves.
Thanks a bunch - just what I was looking for. I assumed I'd find:
#define WM_IDLEUPDATECMDUI (WM_AFXFIRST + 3)
but I guess when you're MS you don't need to do sensible stuff like this.
I do use WM_IDLEUPDATECMDUI so that should get be to the bottom of this.
Thanks again.
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
Hi,
I have an MFC executable (.EXE) that is a dialog with some controls.
On double-clicking a particular control, I want a second dialog to
popup and some information to be passed from the calling dialog
to the called dialog.
For this I was trying to use a user-defined windows message
(WM_POPDLG) and passing the information in a malloc-ed pointer
using SendMessage(). The information will be packed into the WPARAM
parameter. Before sending the message, I will create the called
dialog using Create(). I will retrieve the information in the
PreTranslateMessage() function of the called dialog.
WM_POPDLG has been defined as:
#define WM_POPDLG ((WM_APP) + 100)
When I implemented this idea, I found that the PreTranslateMessage()
is not getting called at all. Create() worked fine.
My question:
What do I need to do so that the message sent by SendMessage() hits the
right place and gets processed correctly. Am I missing out something?
Note:
I do not want the called window to become visible before processing
the message in PreTranslateMessage().
With best regards,
Sayan
Email:sayanmukherjee@indiatimes.com
|
|
|
|
|
The way of handling the messages is by creating handler
for that message. like using
ON_MESSAGE(WM_POPDLG,OnPopDlg)
Dont use the 'PreTranslateMessage'.
Also the 'SendMessage' will not return unless
the message is processed.
But i think u could set the information in the
dialog using, member variables like
CSecondDlg *pdlg = new CSecondDlg(this) ;
pDlg->m_Data = Data ;//Set the Data u want
pDlg->Create(..) ; //Then call create
The Send message I think only needs to be used if u
have to communicate with a window created by
another module, or in another process.
|
|
|
|
|
Hi,
Thank you for your reply.
Why is it that PreTranslateMessage() should not be used? All messages to the
window pass through this function. Isn't it the obvious place to trap the
working of a message? Or, is it reserved for system messages only?
I have tried the code with PreTranslateMessage() and it is not just working.
The code inside is just not getting called for the user-defined message. All
other messages are passing through the function as expected.
Am I missing out something?
With best regards,
Sayan
Email:sayanmukherjee@indiatimes.com
|
|
|
|
|
If you are creating a dialog class that is derived from CDialog, you can simply add a member variable in the CDialog derived class, set that member with your allocated data in the main dialog before you display your second dialog. Then you will be able to access that data in your OnDialogInit handler of your second dialog.
If you are simply calling CreateDialog or DialogBox to display your dialog, then call CreateDialogParam, or DialogBoxParam instead and set the dwInitParam to the allocated data pointer. In your OnInitDialog handler, the LPARAM of that message will be this pointer.
|
|
|
|
|
Can anybody let me know ow i can go about adding a simple volume control to my dialog window application. I am using VS 6.0.
Thanks
|
|
|
|
|
What exactly do u want ?
The UI element or how to control the
volume ?
|
|
|
|
|
Hello,
I was writing a Browser Shell today, for a learning project. And Navigating to the address was giving me all kindsa errors. First shell i created was a MDI, The method i used to nav to the new address didnt work completely, Then i tried it with a SDI, and it worked as long as you did somthing befor entering a new string to navigate too(like right clicking inside the app somehwere) Well after trying many methods i finally found the Answer to my problem.
But i still idndt understand why the first way i tried wasnt working. Heres what i was using,,
void CMainFrame::NewAddress()
{
CString strcAddress;
m_wndDlgBar.GetDlgItemText(IDC_EADDRESS, strcAddress);
((CHtmlView*)GetActiveView())->Navigate(strcAddress);
}
Why was this not working(crashing @ times, Other times working when clicking on somthing first)
Thanks
|
|
|
|
|
If you do not have an active view, then you will be accessing a NULL pointer in this line:
((CHtmlView*)GetActiveView())->Navigate(strcAddress);
If you change your code to this, you will not have a problem:
void CMainFrame::NewAddress()
{
CString strcAddress;
m_wndDlgBar.GetDlgItemText(IDC_EADDRESS, strcAddress);
CHtmlView* pHTMLView = (CHtmlView*)GetActiveView();
if (pHTMLView)
{
pHTMLView->Navigate(strcAddress);
}
}
|
|
|
|
|
Ahhhh i c...
Ya i changed the function to look like your example after researching some.
Thx you ..
|
|
|
|
|
hello, just like getting the mouse cursor coordinates to display a context menu, how can i get the flashing/blinking cursor (use to type text) from a screen (a CEditView )? Can anyone help?
56Kbps of sighs
|
|
|
|
|
I think what u mean is not the cursor but the 'Caret',
yes u can get the position but to get the exact location
about where it is located viz line, char pos has to be loacted
by you.
Use 'GetCaretPos' to get the pt(co-ords) and convert it into the
character position u need.
Just out of curiosity why do u need this position ?
|
|
|
|
|
Prem Kumar wrote:
I think what u mean is not the cursor but the 'Caret',
yes u can get the position but to get the exact location
about where it is located viz line, char pos has to be loacted
by you.
Use 'GetCaretPos' to get the pt(co-ords) and convert it into the
character position u need.
Just out of curiosity why do u need this position
First of all thanks you, i want to get this position to display a listbox because i wanna make something just like the visual studio intellisense
Thanks for all
56Kbps of sighs
|
|
|
|
|
Hi All,
I've got an app that eeds to copy some data to the clipboard. I wrote some code to do this based on a couple of articles I found here, and implemented a copy to clipoboard functionlaity for plain text. So far, so good. But, no I need to copy the same data out as RTF also. Anybody know a simple way I can copy data to the clipboard in multiple formats? Here's sopme code that's not quite working, I am getting a debug assertion the second time through the loop, for the second clipboard format (RTF(:
void CClipboardItem::CopyToClipboard(HWND& hWndNewOwner)
{
// Open the clipboard
OpenClipboard(hWndNewOwner);
EmptyClipboard();
// For every format in the set of supported formats, render data
FormatIterator it;
UINT uFormat;
for(it = m_setFormats.begin(); it != m_setFormats.end(); it++)
{
// Create a shared memory file
CSharedFile sf(GMEM_MOVEABLE | GMEM_SHARE | GMEM_ZEROINIT);
// Render the clipboard data to te shared memory file for the given format
uFormat = *it;
RenderClipboardData(sf, uFormat);
SetClipboardData(uFormat, sf.Detach()); // OOPS! This asserts the second time
}
// All done, let go of the clipboard
CloseClipboard();
}
Any idea why this doesn't work?
|
|
|
|
|
Hey, I'm trying to use Message Reflection for a button I've derived from CButton which is Owner Drawn. I put this in my Message Map:
ON_NOTIFY_REFLECT(WM_MOUSEMOVE,OnMouseMove)
but when I try to goto ClassView it gives me this error:
Parsing Error: Illegal line encountered.
Input Line: ON_NOTIFY_REFLECT(WM_MOUSEMOVE,OnMouseMove)
What am I doing wrong? I'm new to this relecting deal, is there an alternatve?
|
|
|
|
|
Hey, I'm trying to use Message Reflection for a button I've derived from CButton which is Owner Drawn. I put this in my Message Map:
ON_NOTIFY_REFLECT(WM_MOUSEMOVE,OnMouseMove)
but when I try to goto ClassView it gives me this error:
Parsing Error: Illegal line encountered.
Input Line: ON_NOTIFY_REFLECT(WM_MOUSEMOVE,OnMouseMove)
What am I doing wrong? I'm new to this relecting deal, is there an alternatve?
|
|
|
|