|
Until recently I was of the same opinion as You. Big was my surprise when I saw a program that could do that. Please se my reply to David Crow for further details.
And, also thank's to You for taking the time to answer.
Regards.
jh
|
|
|
|
|
How can I insert data from a flat file like .txt file into SqlServer database.
|
|
|
|
|
Read the file data into a string and place it into the database firing some query for inserting data.
What problem are you having . Reading the file or inserting data in the database?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
You can always use SQL Server's DTS utility. Or use the SQL command Bulk Insert
onwards and upwards...
|
|
|
|
|
Hi
I was using sendmesage function to a window in my DLL which is attached to other application using windows hook, mainly to get text from a control.
sendmessage(hwnd,WM_GETTEXT,(wparam)100,(lparam)sztext); To my surprise sendmessage was not able to retrieve text in sztext.
could the problem lies in the creator of application who has not properly written code in WM_GETTEXT case. I think he/she may not have written appropriate code to provide proper response when send message function with WM_GETTEXT is called.
Am I wrong in analysing
please reply if u have encountered a problem like this before
thanks
|
|
|
|
|
It's hard to say. Here[^] is an interesting article on WM_GETTEXT and GetWindowText .
Steve
|
|
|
|
|
Thanks link was highly usefull.
|
|
|
|
|
Was it a password edit box ?
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
No it was dialog box.
I dont have to write program to retrive passwords, it is already written by others.I can find some here
|
|
|
|
|
Javagal Srinath wrote: I dont have to write program to retrive passwords, it is already written by others.I can find some here
No offense meant, it is only that edit boxes with password option set react differently to the WM_GETTEXT message as when it is not set.
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
Javagal Srinath wrote: sendmessage(hwnd,WM_GETTEXT,(wparam)100,(lparam)sztext);
Is hwnd a valid window handle?
Javagal Srinath wrote: To my surprise sendmessage was not able to retrieve text in sztext.
How was sztext declared?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
hwnd was a window handle returned when a notification that a new window is created was recieved to my filter function cbtproc. The hook code was HCBT_CREATEWND
I think sztext was properly declared
May be we can not send "sendmessage(hwnd,WM_GETTEXT,(wparam)100,(lparam)sztext);" to retrieve text to all type of window.
|
|
|
|
|
how can I iterate file pointer within a file consisting list of file.
that is, when ever it iterates i get next list file using vc++(mfc)
kamalesh
|
|
|
|
|
You can use CFileFind to list the files on a local disk. If you already have filenames listed in a single file, than it's up to you to find a way of cuting it into filenames. Be aware that "somename.txt.exe.pdf" is just one file...
|
|
|
|
|
As far as I can understand this,You have a file with some file name's stored in it.SO you want to move to the next record(filename) in your file when user takes /performs some action and show the text/name of the file. Am I right?
If yes, you can go ahead with this method :
1) Open the file.
2) Read the first element. (eg. Do this in while loop)
3) Prompt the user if he want to see the next name.
4) A)yes . show the next entry in the file
B)No . Break out of the loop.
You can use fread for reading the elements in the file.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
-- modified at 6:53 Friday 23rd June, 2006
|
|
|
|
|
kamalesh82 wrote: how can I iterate file pointer within a file consisting list of file.
That really depends on how you are reading the file. Any read operation on a file will advance the file pointer automatically. You can also do it programmatically via fseek() , SetFilePointer() , or CFile::Seek() .
kamalesh82 wrote: that is, when ever it iterates i get next list file using vc++(mfc)
Are you using the CFileFind ?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I htink that you mean that you have a text file, containing file names, each file name on a line of text and you want to iterate throug it.
If that is true, you have to read the file one char at a time and stop when you get to the combination CRLF (0x0d 0x0a).This is an line end.
If your text file is written in UNICODE be aware that 1 unicode char has 16 bits(2 bytes).The "normal" one has 8 bits(1 byte).
|
|
|
|
|
I just read in the file into a CString object and tokenize to the new line character using a while loop.
i.e. filename = fileContent.Tokenize("\n",iStart);
hope this helps.
Ferdinad
|
|
|
|
|
noob here so be gentle...
How difficult is it to add Unicode support for an existing application? Can anyone point me to some tutorials/docs on this matter? I need to do this for a project that was desinged a few years back and i really do not want to go into the code..
|
|
|
|
|
|
The firt thing to do would be to add the following two directives to the top of the project's stdafx.h file:
#define UNICODE
#define _UNICODE Now compile the project and you'll see what statements need to be changed.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Unicode means using "wide chars".So any code using char* will need to be checked&MODIFIED .You should particulary pay attention to the places where you pass the size of the string in bytes since
strlen(string)is the good size (in bytes) for non unicode but not for unicode.
Basically you should(VC6.0):
1)Add an "Unicode Debug" and an "Unicode Release" configuration (Build/configurations)
2)define UNICODE and _UNICODE in the *project settings* AND REMOVE the define _MBCS for the defined configurations.Also Change the entrypoint(Tab"Link",Category:"output")from empty to "wWinMainCRTStartup"(if you are using MFC)
3)Surround any text in code with _T() like : _T("text here")
4)Search in MSDN "Routine Mappings" to find out what string functions you should replace and with what(Ex:_tcslen instead of strlen)and relace them.Replace any "char" with "TCHAR" if it is used for strings.
5)Change the font for all dialogs to one that supports Unicode (Like Arial,Tahoma)
6)Pray to god you haven't missed something,Compile,Fail to link,notice that you have dependencies that are not unicode and start all over again.
Sorry for the bad news.
|
|
|
|
|
Actually, i've posted this question after going trough steps 1 to 6 (minus the start all over again part) and I was hoping for an easyer aproach.
So basically i'm up to my ears into a summer of search and replace plus one month of serious debugging. I hate programmers that don't use unicode by default for their applications(myself included )
|
|
|
|
|
Hi,
I want to insert a HBitmap object in the CRichEditCtrl. For this purpose I am using the CImageDataObject class (defined by the following open-source project)
http://www.codeguru.com/cpp/controls/richedit/article.php/c5383/[^]
My problem is that it works fine if I use the bitmaps which are loaded from resources. but gives a Memory exception if I create my own bitmap.
My bitmap creation function is given as follows
HBITMAP MyImage::MakeBitmap2()
{
if (!pDib)
return NULL;
HBITMAP handle = NULL;
HDC dc = ::CreateCompatibleDC(NULL);
if (dc)
{
// tmpBitmap is a dummy, to satisfy ::CreateCompatibleDC (it
// is a memory dc that must have a handle selected into it)
BITMAPINFO bi;
ZeroMemory(&bi, sizeof bi);
bi.bmiHeader.biSize = sizeof (BITMAPINFOHEADER);
bi.bmiHeader.biWidth = GetWidth();
bi.bmiHeader.biHeight = GetHeight();
bi.bmiHeader.biPlanes = 1;
bi.bmiHeader.biBitCount = 24;
VOID* pvBits;
handle =CreateDIBSection(dc, &bi, DIB_RGB_COLORS, &pvBits, NULL, 0);
if (handle==NULL)
{
return NULL;
}
HBITMAP oldBitmap = (HBITMAP) ::SelectObject(dc, handle);
StretchDIBits(dc, 0, 0, head.biWidth, head.biHeight, 0, 0, head.biWidth, head.biHeight,
info.pImage,(BITMAPINFO*)pDib, DIB_RGB_COLORS,SRCCOPY);
::SelectPalette(dc, NULL, TRUE);
::SelectObject(dc, oldBitmap);
::DeleteDC(dc);
}
return handle;
}
I am already using this function for doing some other image related tasks and it is working fine,
So can any body tell me why isn't it working with that object.
|
|
|
|
|