|
Anu_Bala wrote: 1 LogFile User1 ModelDT002
MSDN description of flag
LVFI_PARTIAL :-Matches if the item text begins with the string pointed to by the psz member. This value implies use of LVFI_STRING.
In your case Item text begins with 1. Thats the problem.
|
|
|
|
|
So, how can i search the second item that is "logfile" i have to find that only.
Anu
|
|
|
|
|
See if its good for you(without create editbox because you dont need to it, find in list)
<br />
USES_CONVERSION;<br />
CEdit m_Edit;<br />
CString str22;<br />
TCHAR buffer[100];<br />
LVFINDINFO find1={0};<br />
<br />
m_Ctrl1.InsertItem(0,"test");<br />
m_Ctrl1.InsertItem(1,"test1");<br />
m_Ctrl1.InsertItem(0,"a"); <br />
m_Ctrl1.InsertItem(0,"b"); <br />
m_Ctrl1.InsertItem(0,"test"); <br />
m_Ctrl1.InsertItem(0,"a1"); <br />
m_Ctrl1.InsertItem(0,"b1"); <br />
m_Ctrl1.InsertItem(0,"test"); <br />
<br />
m_Edit.Create(WS_CHILD|WS_VISIBLE,CRect(0,0,100,23),this,1);<br />
m_Edit.SetWindowText("test");<br />
m_Edit.GetWindowText(str22);<br />
int index=-1;<br />
<br />
<br />
find1.psz = str22;<br />
find1.flags = LVFI_STRING;<br />
do<br />
{<br />
index=m_Ctrl1.FindItem(&find1,index);<br />
MessageBox(itoa(index,buffer,10));<br />
<br />
}while(index!=-1);<br />
and see this thread[^]
|
|
|
|
|
my coding is
if(Fname =="LogFile")
{
///////////anu
LVFINDINFO info={0};
int nIndex ;
int nstart = -1;
LPCTSTR lpszmyString ="LogFile";
info.flags = LVFI_STRING;
info.psz = lpszmyString;
if ((nIndex=pCtrl->FindItem(&info,nstart)) != -1)
{
Index = pCtrl->InsertItem(nIndex,Sno);
pCtrl->SetItemText(Index,1,Fname);
pCtrl->SetItemText(Index,2,Instr);
pCtrl->SetItemText(Index,3,Traine);
pCtrl->SetItemText(Index,4,ModelName);
pCtrl->SetItemText(Index,5,Model);
// pCtrl->SetItemText(Index,5,Modeltwo);
cnt=1;
sno+=1;
newsno=sno;
}
}
else
{ /////anu
Index=pCtrl->InsertItem(RowIndex,Sno);
pCtrl->SetItemText(Index,1,Fname);
pCtrl->SetItemText(Index,2,Instr);
pCtrl->SetItemText(Index,3,Traine);
pCtrl->SetItemText(Index,4,ModelName);
pCtrl->SetItemText(Index,5,Model);
// pCtrl->SetItemText(Index,5,Modeltwo);
cnt=1;
sno+=1;
newsno=sno;
}
}
Anu
|
|
|
|
|
Did you see my code it doesnt work did you see that link and alos you can see a example in msdn
|
|
|
|
|
LVFINDINFO info;
int nIndex;
CString buffer;
CString lpszmyString = "LogFile";
int subItem = 2; // or which ever column you want
int itemCnt = pCtrl->GetItemCount();
for(int x = 0; x < itemCnt; x++)
{
buffer = pCtrl->GetItemText(x,subItem);
if(buffer == lpszmyString)
{
Index = pCtrl->InsertItem(x,Sno);
// note:
/*
This doesn't actually remove this item
by inserting an item at the index, all items below the index are pushed down;
I think what you want is:
pCtrl->SetItemText(x,0,Sno);
*/
}
}
|
|
|
|
|
can anyone please help me in reading the font bitmap info of a specific character
from the TTF font file?
I need to get the bitmap bytes for a given character from the font ttf file
so that i can use that bitmap to paint the same on the screen.
Thank you in advance.
|
|
|
|
|
Why?
Wouldn't it be easier to generate output using a memory DC into a bitmap using standard text functions?
If you needed to save the generated bitmap, you could.
Steve S
Developer for hire
|
|
|
|
|
Hi,
Thank you for the reply.
I am new to this windows stuff and i really don't know the simple way to do.
just thought we might have to read it from font file .
The only thing i am interested is the bitmap created due to that character.
Please help me by mentioning how do we do that from memory DC etc..
Thank you.
|
|
|
|
|
Well, often you don't need to do anything other than use CreateFont or CreateFontIndirect, then select that font into a DC before using any of the text output functions. Controls generally support being sent a WM_SETFONT message so that they use the correct font themselves.
To retrieve the bitmap of a font character isn't difficult, but there are limitations.
1. Create the font (use CreateFont or CreateFontIndirect).
2. Select the font into a screen DC
3. Use GetTextExtent to find out how big a bitmap you need for your text.
4. Deselect the font from the screen DC
5. Create a compatible (with the screen DC) DC - your memory DC
6. Create an appropriately sized compatible bitmap (compatible with the screen DC, not the memory DC), and select it into your memory DC.
7. Set a background colour for the memory DC
8. Set a text colour for the memory DC.
9. Select your font into the memory DC.
10. Output your text
--- You now have the bitmap
11. CLEAN UP!
Deselect the font from memory DC and delete it
Deselect bitmap from memory DC and delete it
Delete memory DC
12. Don't forget to release the screen DC you got in stage#2.
There, that was easy, wasn't it ?
Unless you're saving the bitmaps, like I say, you just need to create and select the font you need, before drawing text, in which case, most of the work is done for you
Steve S
Developer for hire
|
|
|
|
|
Thanks for your help, i could get the data.
but still held up with another issue
I am trying to get the font from the present foreground window
like notepad. but always i get the font as system only.
How do i get the device context of the client window in a windows (lets say in notepad).
i hope "GetDCEx" is the function that gets the Client DC, but i could figure out
how it works
Can anyone please help me to find the DC of the client window so that i can get the
font used by it by using "GetTextFace" function.
Thank you.
|
|
|
|
|
Given an HWND, GetDC(hWnd) will return the DC for the client window.
Steve S
Developer for hire
|
|
|
|
|
hi i m using setwindows hook functin with low level keyboard as paramter. in application it works fine and capture all global keystrokes but it is not working in service call back function is not called.i m calling setting hooks from servicemain function without the thread and hook is setted does not return null.
my service is interactive service it means it listen the windows events.
-- modified at 3:22 Tuesday 22nd August, 2006
Tasleem Arif
|
|
|
|
|
From MSDN on the SetWindowsHookEx API:
"These events are associated either with a specific thread or with all threads in the same desktop as the calling thread."
I have underlined the relevant part.
If you want a service to "interact with desktop" I would first investigate the "Allow service to interact with desktop" checkbox in the services properties.
Steve
|
|
|
|
|
thanks for reply here is the code for the creating service i think it is interactive mean can access user input and desktop.
schService = CreateService(schSCManager,
TEXT(SZSERVICENAME),TEXT(SZSERVICEDISPLAYNAME),SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS | SERVICE_INTERACTIVE_PROCESS ,SERVICE_DEMAND_START, SERVICE_ERROR_NORMAL,szPath, NULL,
NULL,TEXT(SZDEPENDENCIES),NULL,NULL);
and for the hooks
hHook = SetWindowsHookEx(WH_KEYBOARD_LL, LowerLevelKeyboardProc, hInstance,0);
if(hHook==NULL)
printf("SetHooks failed\n");
if i associate it with the specific thread will that thread will be called itslef regardless when created through createthread and once executed.
i will be very thankful to you if you provide me any further info.Thanks
If you want a service to "interact with desktop" I would first investigate the "Allow service to interact with desktop" checkbox in the services properties. services dont have such property i m using vc++.
-- modified at 4:32 Tuesday 22nd August, 2006
Tasleem Arif
|
|
|
|
|
I am assuming your hInstance is the instance of a DLL you loaded that contains the hook procedure as an exported function? Otherwise, this will not work.
The 'global' hook procedure can not be in your service EXE file, it must be in a DLL your service loads dynamically.
Try using LoadLibrary and GetProcAddress to make it work.
SetWindowsHookEx(WH_KEYBOARD_LL, LowerLevelKeyboardProc, hInstance,0);
It does not make sense to load a local keyboard hook in your service, since the service will never have 'focus' under 'normal' circumstances.
Any sufficiently gross incompetence is nearly indistinguishable from malice.
|
|
|
|
|
i m using the MFC extension dll and its callback function def like this and
works well from the desktop application.
LRESULT __declspec(dllexport)__stdcall CALLBACK KeyboardProc(int <br />
<br />
nCode,WPARAM wParam,LPARAM lParam) i m using this function to from
service to call th dll which also works for the desktop application.
typedef BOOL (CALLBACK *inshook)(); <br />
inshook instkbhook;<br />
hInstance= LoadLibrary((LPCTSTR) "hodll.dll"); <br />
instkbhook =GetProcAddress(hInstance, "installhook"); <br />
instkbhook();
i had googled a lot to find any example that uses callback or hook but was
not successful.dont know what to do or how to solve.My service is also
allowed to interact with desktop.
Tasleem Arif
|
|
|
|
|
See here[^] if its good for you
|
|
|
|
|
i had read those kind of pages nad found no solution that is why i posted question on that forum otherwise i cound do himself n tried to do so but result was 0%.
microsoft had not documented what to do inorder to make a service as desktop just link here n there but no to the poin answer.
Tell me what to do in order to make service runnig as desktop except specifying SERVICE_WIN32_OWN_PROCESS | SERVICE_INTERACTIVE_PROCESS parameter n creating service.
when i click on the service name and then properties and then logon through this code the checkbox "allow service to interact with desktop" was checked i think there it is present still cannot get the callback functions.
-- modified at 6:53 Tuesday 22nd August, 2006
-- modified at 7:37 Tuesday 22nd August, 2006
Tasleem Arif
|
|
|
|
|
Hi friends,
I am working on one Image processing application where I worked on the Histogram equalization, Histogram based Image segmentation and edge detection algorithms.
In my application I need to write one algorithm for object reorganization and object matching (the master Image is stored in to the DB) .
But the practical limitation is the object is of the shape of bullet and is coming in any position on the conveyor and I am grabbing the Image using CCD camera.
I have to compare the Master Image of the bullet I have in DB with the grabbed Image from the conveyor.
Please suggest any algorithm or library if anybody knows for this purpose
Regards,
Dinesh
"Failure is success if we learn from it"
-- modified at 2:41 Tuesday 22nd August, 2006
|
|
|
|
|
hello,
Iam using "CRecordset" class to access SQL database in another PC
through network(PEER to PEER).
Everything works fine when the network connection is active..
When the network connection is breaked and resumed for period of time,
the database cannot be accessed.
how to reconnect the database after the network is resumed???
give me a solution....
"Empty mind is devils workspace"
|
|
|
|
|
hi
how to convert CString to double format??
"Every morning I go through Forbes list of 40 richest people in the world. If my name is not in there, I go to work..!!!"
|
|
|
|
|
|
<br />
#include stdlib.h<br />
CString str = "123.0045";<br />
double a = atof(str);<br />
|
|
|
|
|
i am using two Command Buttons one for sending another for receiving data can be stored in a file
plese help me
advanced thanks
prasad raju
|
|
|
|
|