|
hi jesse,
Actually its easier to add the date as CString's rather then the hard way out.
Ctime time;<br />
CString m_appdate;<br />
time = time.GetCurrentTime();<br />
m_appdate = time.Format("%d-%m-%y");<br />
const char *appdate = (LPCTSTR)m_appdate;<br />
SQLINTEGER cappdate = SQL_NTS;<br />
<br />
<br />
sr = SQLBindParameter(hstmt,6,SQL_PARAM_INPUT,<br />
SQL_C_TCHAR,SQL_C_TCHAR,10,0,<br />
(void *)appdate,sizeof(appdate),&cappdate);<br />
if(sr != SQL_SUCCESS && sr != SQL_SUCCESS_WITH_INFO)<br />
{<br />
displayError(sr,"Error in Binding 6");<br />
}
I think that will help u out......
Pavneet
|
|
|
|
|
Pavneet,
Thanks for your response. In my case, this will not work, as the datatype of the date column is datetime and the Bind call fails unless you use SQL_C_TYPE_TIMESTAMP to describe it.
After reviewing the documentation on localtime, I found I can fix up the date in the following manner:
time (&now);<br />
localNow = localtime (&now);<br />
printf ("%s", asctime (localNow));<br />
<br />
memset (&tsOpenDate, 0, sizeof(tsOpenDate));<br />
tsOpenDate.year = localNow->tm_year + 1900;<br />
tsOpenDate.month = localNow->tm_mon + 1;<br />
tsOpenDate.day = localNow->tm_mday;<br />
tsOpenDate.hour = localNow->tm_hour;<br />
tsOpenDate.minute = localNow->tm_min;<br />
tsOpenDate.second = localNow->tm_sec;
'til next we type...
HAVE FUN!! -- Jesse
|
|
|
|
|
Pavneet,
Found another way to get the timestamp without the fixup that locatime needs: An SDK function called GetLocalTime
Here's another code snippet showing its use:
SYSTEMTIME systemTime;<br />
GetLocalTime (&systemTime);<br />
<br />
memset (&tsOpenDate, 0, sizeof(tsOpenDate));<br />
tsOpenDate.year = systemTime.wYear;<br />
tsOpenDate.month = systemTime.wMonth;<br />
tsOpenDate.day = systemTime.wDay;<br />
tsOpenDate.hour = systemTime.wHour;<br />
tsOpenDate.minute = systemTime.wMinute;<br />
tsOpenDate.second = systemTime.wSecond;<br />
'til next we type...
HAVE FUN!! -- Jesse
|
|
|
|
|
Has anybody here used the CMultiColumnComboBox class written by Xiao Wu Guang? The link is http://www.codeproject.com/combobox/mccombobox.asp#xx737862xx. In the posts at the end of the artice, there are some problems with using this class in Windows 2000/XP. Unfortunately, the link to the fix doesn't work anymore. Does anybody know how to make this class work correctly in Windows 2000/XP? It would be nice if one of the better programmers on here (definitely not me) would update this class and repost it with all the fixes! Thanks 
|
|
|
|
|
Hi, I use the MultiColumnComboBox class, I made some changes (which I found in the forum), here is the additional code :
.cpp :
------
in the DrawItem() function, under :
CRect TextRectangle = lpDrawItemStruct->rcItem;
// **** Additional coding Start ****
if (DropDownWindowPointer == NULL)
{
if((GetWindowLong(m_hWnd, GWL_STYLE) & 0x3) == CBS_DROPDOWN)
{
DropDownWindowPointer = GetWindow (GW_CHILD);
}
if((GetWindowLong(m_hWnd, GWL_STYLE) & 0x3) == CBS_DROPDOWNLIST)
{
DropDownWindowPointer = GetWindow (GW_HWNDFIRST);
}
}
// **** Additional coding End ****
under // if vertical scrool bar is visible : replace :
if ((ColumnIndex == m_TotalColumn - 1 || (ColumnIndex == m_TotalColumn - 2 && m_ColumnWidth[m_TotalColumn - 1] == 0)) && (DropDownWindowPointer->GetStyle() & WS_VSCROLL))
TextRectangle.right -= GetSystemMetrics(SM_CXVSCROLL);
BY :
DeviceContextPointer->DrawText(m_ColumnItemList[ColumnIndex].GetAt(m_ColumnItemList[ColumnIndex].FindIndex(lpDrawItemStruct->itemID)), -1, TextRectangle, m_ColumnAlignStyle[ColumnIndex] | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER);
I think it's all;
if you still have a problem, just answer and I'll send you the complete file.
BrutalDeath0
|
|
|
|
|
I have an MFC application that displays a modeless dialog during a file transfer with the status information. That all works fine, I can update the info in the dialog box with the current file transfer status info. The problem is the user can still try to interact with the main window while this modeless dialog is displayed. What I would like is to have the modeless dialog behave similar to a modal dialog where the user can only interact with that dialog and not access the main view. I do not want to use a modal dialog because the main program needs to continue processing the file transfer. Any ideas on what is the best way to do this?
|
|
|
|
|
Have the main program process your file transfer in a thread, then you'll be able to use a modal dialog box. That's probably not exactly what you were looking for, but it's what I'd try first. Good luck
|
|
|
|
|
maybe by using CWnd::EnableWindow on the main window can do the trick.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Note that you may have to call CWnd::EnableWindow( TRUE ) on the modeless dialog after calling CWnd::EnableWindow( FALSE ) on the parent...
Disabling the parent tends to take child windows with it.
Peace!
-=- James (Sonork:100.21837)
[Tip for SUV winter driving survival: "Professional Driver on Closed Course" does not mean "your Dumb Ass on a Public Road"!] [Get Delete FXP Files Now!]
|
|
|
|
|
|
The AfxGetMainWnd()->EnableWindow(false) did the trick. Always seems so obvious when you know the answer.
The article in http://www.codeproject.com/threads/TemplatedLengthyOperation.asp answered some other questions I had about function pointers.
Thanks for everyones help. Eric
|
|
|
|
|
Searched MS site but only found WDT for NT/2K/XP.
'til next we type...
HAVE FUN!! -- Jesse
|
|
|
|
|
This seems like a really simple question, but I can't find the answer anywhere else and I know someone in here has to have faced it before.
At the commandline (at least on NT/2k/XP, which is all that matters in this question), you can rename a file which is currently locked using ren and the program holding the file will adjust, allowing you to put a new file in its place ready for later.
If I try to do this using MoveFileEx then (not entirely surprisingly) it complains that the file is locked.
I could open a new process and use the commandline, and I will if I have to, but if there's some way of convincing MoveFileEx or call something else to rename the file then I'd prefer not to have a DOS box flash up.
Does anyone know if this is possible?
Paul
|
|
|
|
|
Does SHFileOperation() work any better?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
have a look at ShFileOperation I think it works for locked files.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
You guys rock, thanks. Serious brain freeze on my part.
Paul
|
|
|
|
|
I am having a problem compiling a class I downloaded from CodeProject. The class compiles until I try to create a variable of that type, and then I get a linker for each function that I try to call with that variable (to begin with, just the constructor and destructor.) Here are the compiling errors that I am receiving:
error LNK2019: unresolved external symbol "public: __thiscall CMultiColumnComboBox::CMultiColumnComboBox(void)" (??0CMultiColumnComboBox@@QAE@XZ) referenced in function "public: __thiscall NewInvoice::NewInvoice(void)" (??0NewInvoice@@QAE@XZ)
error LNK2001: unresolved external symbol "public: virtual __thiscall CMultiColumnComboBox::~CMultiColumnComboBox(void)" (??1CMultiColumnComboBox@@UAE@XZ)
The class is the CMultiColumnComboBox class from http://www.codeproject.com/combobox/mccombobox.asp#xx169761xx[^] The directions say to include the file in the .cpp file, but then I cannot declare variables in my .h file, so I had to include the class in my .h file. Now I'm getting these linker errors. Can somebody please give me some suggestions? Thanks a bunch!!
|
|
|
|
|
Did u add the file in the project?
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
yes, the files are included in the project. 
|
|
|
|
|
DougW48 wrote:
The directions say to include the file in the .cpp file, but then I cannot declare variables in my .h file...
Probably because the two .h files are in the wrong order. The #include <MultiColumnComboBox.h> statement should precede the inclusion of your dialog's .h file. Or, if your dialog declaration is going to be used in places other than by its definition, you'll need the #include <MultiColumnComboBox.h> statement in the dialog's .h file instead, before any reference to the CMultiColumnComboBox class.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Found the problem, thank you very much! 
|
|
|
|
|
DougW48 wrote:
Found the problem...
So what was it?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
When I included the files, the visual studios put them in a separate virtual folder called "Solution Items" I moved them into the same area of my solution explorer as my other files, and it compiled without a hitch. Now if I could just figure out how to update the class to work in 2000/XP I'll be all set, but that's for a different post! Thanks a bunch for your help!
|
|
|
|
|
How would you go about attaching 'winnm.dll' to a project? I am just unable to get my head around linking the dll files then accessing them. Do i need to create a header file?
What will i then need to include in the header file? I need to create a simple keyboard which uses low level design to produce sound through the sound card.
Any help would be appreciated.
Cheers
Mav
|
|
|
|
|
If you are thinking winmm.dll , you do not directly link DLLs to a project, you link the import library for them with the project. Try adding winmm.lib to your list of Libraries to link with.
Peace!
-=- James (Sonork:100.21837)
[Tip for SUV winter driving survival: "Professional Driver on Closed Course" does not mean "your Dumb Ass on a Public Road"!] [Get Delete FXP Files Now!]
|
|
|
|