|
Items in a listbox are indexed from 0, so your first item has the index 0, the second has the index 1, the rhitd has the index 2, and so on...so if you you do GetItemText(2, 0) you will get the text of the third item. Could that be your "problem"?
Good luck with the learning
|
|
|
|
|
already knew what you said. I fiquired out what it was. I had put another item in the listbox but that item was not in my vector so there was a difference of 1 item. Thanks anyway.
A C++ programming language novice, but striving to learn
|
|
|
|
|
Hello,
I have a dialog with all kinds of controls, Edit boxes, radio buttons...etc..
I would like to Process data when tab key is pressed only in couple of the edit controls, not any of them. Using pMsg->wParam == VK_TAB in PreTranslate Message will let me do that upon pressing the Tab key anywhere. I thought of capturing the focus on the desired control but didn't work.
Any ideas?
Thanks
|
|
|
|
|
You can use of HWND hwnd=GetFocus(); for get current focus and then you need to check hwnd of your control with it on the VK_TAB.
|
|
|
|
|
If I've understand you well you want to process date on some controls when they lose focus? If so you can setup message handlers (for KILLFOCUS type of messages) on those controls.
Personally I do all my checking when user is done, say when he presses ok button. This is because one can navigate from control while not finishing with his input and then navigate back to that same control to enter more data.
Hope this helps, if no I'll try to be more clear in future posts.
|
|
|
|
|
Hi guys, I'm a new programmer and I'm using CreateFileMapping in my service and trying to open it up with my Process with user A. OpenFileMapping with user A returns a file not found error. I know the file mapping works if I open two processes with the same user. I was able to get two services to share a file mapping correctly. So this must mean that the file mapping is out of scope to user A. Please help.
TCHAR SharedMemoryName[] = _T("Global\\Shared Memory1");
HANDLE handle_SharedMemory = CreateFileMappingA(
INVALID_HANDLE_VALUE,
NULL,
PAGE_READWRITE,
0,
MAX_SH_MEM_SIZE,
(LPCSTR) SharedMemoryName );
TCHAR SharedMemoryName[] = _T("Global\\Shared Memory1");
HANDLE handle_SharedMemory = OpenFileMappingA(
FILE_MAP_ALL_ACCESS,
FALSE,
(LPCSTR) SharedMemoryName );
|
|
|
|
|
Have you enabled "Interact with desktop" for the service?
|
|
|
|
|
Yes it is enabled. Any other suggestions?
|
|
|
|
|
What operating system is the service running on? Try using AdjustTokenPrivileges to set SeCreateGlobalPrivilege in the service before creating the mapping.
|
|
|
|
|
It still doesn't work. This is what I did. Perhaps I did something wrong here?
HANDLE l_handle_Token;
TOKEN_PRIVILEGES l_tokenprivileges_myPrivileges;
if( !OpenProcessToken( GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &l_handle_Token ) )
{
WriteLog( g_cLogFile, _T("OpenProcessToken failed \n") );
return (FALSE);
}
LUID l_luid_ID;
if( !::LookupPrivilegeValue( NULL, SE_CREATE_GLOBAL_NAME, &l_luid_ID ) )
{
WriteLog( g_cLogFile, _T("LookupPrivilageValue failed \n") );
CloseHandle( l_handle_Token );
return (FALSE);
}
else
{
WriteLog( g_cLogFile, _T("LookupPrivilageValue successful \n") );
l_tokenprivileges_myPrivileges.PrivilegeCount = 1;
l_tokenprivileges_myPrivileges.Privileges[0].Luid = l_luid_ID;
l_tokenprivileges_myPrivileges.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges(
l_handle_Token,
FALSE,
&l_tokenprivileges_myPrivileges,
sizeof(TOKEN_PRIVILEGES),
(PTOKEN_PRIVILEGES)NULL,
0 );
CloseHandle( l_handle_Token );
}
|
|
|
|
|
I checked the service information with process explorer and it does show that SE_CREATE_GLOBAL_NAME(SeCreateGlobalPrivilege ) is set. CreateEvent(...) was set up and called similarly, and that works fine. I initially had problems with access violations with OpenEvent(...) but atleast I know there is something there, and I fixed that with creating an empty security attribute and passing that in with OpenEvent(...). This is beyond me. More ideas would greatly be appreciated.
|
|
|
|
|
Solution: The casting is wrong. Now I just have to find a way to pass my TCHAR array/string correctly.
g_handle_SharedMemory[i_counter] = CreateFileMapping(
INVALID_HANDLE_VALUE,
&l_securityattributes_AllAccessAttr,
PAGE_READWRITE,
0,
MAX_SH_MEM_SIZE,
"Global\\Shared Memory" );
instead of
g_handle_SharedMemory[i_counter] = CreateFileMapping(
INVALID_HANDLE_VALUE,
&l_securityattributes_AllAccessAttr,
PAGE_READWRITE,
0,
MAX_SH_MEM_SIZE,
(LPTSTR)Somestring );
|
|
|
|
|
Hi to all. I have an app for burning optical media using IMAPI2. I'm handeling device changed messge (WM_DEVICECHANGE) so I could track insertion or removal of media in record drive. When media is arrived I try to get type od media wich is inserted (eg. DVD-R). My app reports this error:
"First-chance exception at 0x7c812aeb in MyBurner.exe: 0x8001010D: An outgoing call cannot be made since the application is dispatching an input-synchronous call."
What I'm doing is this:
IDiscFormat2Data->get_CurrentPhysicalMediaType(&mediaType);
Could you please tell me why is this happening and how to fix this? Thanks in advace.
|
|
|
|
|
If you're importing a typelib, you get lots of wrapper functions, which fire off exceptions.
I hate this with a passion, and end up using the raw_XXXX versions, which return a nice friendly HRESULT. It may be that windows needs a bit of time after the instertion of the media for it to be useful - so you may want to check a few times, waiting a couple of seconds between each attempt. If you use the non-throwing access function, you get the chance to do this.
No knowledge specifically of IDiscFormat2Data though...
Good luck!
Iain.
|
|
|
|
|
Thanks Iain.
You are right I'm using wrap functions in this case (although they also return HRESULT).
And yes I've already tried with 'sleep' function after I get my message of media being inserted in optical drive, but no success there.
|
|
|
|
|
Hello,
I am changing the properties od CRichEditCtrl in resource script but the changes are not permanent in nature.
How to upadte it.
Thanks & Regards.
|
|
|
|
|
Dhiraj kumar Saini wrote: I am changing the properties od CRichEditCtrl in resource script but the changes are not permanent in nature.
How so?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi,
Can u please tell me how to access records from multiple tables in oracle 10g to a SDI application having database support(VC++),using ODBC to access the dsn.
|
|
|
|
|
Only if you can use the search facility provided here on CP with "ODBC" as the search string.
Some things seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Divya Lalwani wrote: Can u please tell me how to access records from multiple tables...
Can you use a JOIN statement?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
|
I can access all data from a single table.But If I want to access selected data from multiple tables then I get an error after executing.
ERROR: ORA-00903: invalid table name
DSN Name: om_ebridge.
Oracle User Name: SCOTT
Table Names: Transaction_Master,Transporter_Master,Supplier_Master,Product_Master.
CString CMyebridgeSet::GetDefaultConnect()
{
return _T("ODBC;DSN=om_ebridge");
}
CString CMyebridgeSet::GetDefaultSQL()
{
//return _T("[SCOTT].[TRANSACTION_MASTER]");(works to access data from single table.)
(But ERROR occurs if the below mentioned INNER JOIN is used to access selected data from multiple tables .Can you please help me access data).
return _T("SELECT TRANSACTION_MASTER.TRANSACTION_CODE,TRANSACTION_MASTER.VEHICLE_NO,TRANSACTION_MASTER.OPERATING_MODE,")
_T("TRANSPORTER_MASTER.transporter_name,SUPPLIER_MASTER.SUPPLIER_NAME,")
_T("PRODUCT_MASTER.PRODUCT_NAME,TRANSACTION_MASTER.unit,TRANSACTION_MASTER.Gross_Wt,TRANSACTION_MASTER.Gross_WtTime,")
_T("TRANSACTION_MASTER.Tare_Wt,TRANSACTION_MASTER.Tare_WtTime,TRANSACTION_MASTER.CONTAINER1_TAREWT,")
_T("TRANSACTION_MASTER.CONTAINER2_TAREWT ,TRANSACTION_MASTER.net_Wt,TRANSACTION_MASTER.Challan_no,TRANSACTION_MASTER.Challan_Wt,")
_T("TRANSACTION_MASTER.No_Of_Units,TRANSACTION_MASTER.Calculated_Wt,TRANSACTION_MASTER.Formula1,")
_T("TRANSACTION_MASTER.Formula2,TRANSACTION_MASTER.Formula3,TRANSACTION_MASTER.Formula4,")
_T(" TRANSACTION_MASTER.location_code,TRANSACTION_MASTER.field1,TRANSACTION_MASTER.field2,TRANSACTION_MASTER.field3 ")
_T("from PRODUCT_MASTER INNER JOIN SUPPLIER_MASTER INNER JOIN TRANSACTION_MASTER")
_T("ON SUPPLIER_MASTER.SUPPLIER_CODE =TRANSACTION_MASTER.SUPPLIER_CODE")
_T("ON PRODUCT_MASTER.PRODUCT_CODE=TRANSACTION_MASTER.PRODUCT_CODE")
_T("INNER JOIN TRANSPORTER_MASTER ON TRANSPORTER_MASTER.TRANSPORTER_CODE=TRANSACTION_MASTER.TRANSPORTER_CODE ");
}
|
|
|
|
|
Perhaps you should try a smaller query first until you get the syntax right. After that, add to it.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
When i execute this query in oracle's PLSQL> prompt or in toad the the data from respective tables is displayed.
When accessing data from multiple tables on a single form,is necessary to implement parameterized recordset(ODBC).
|
|
|
|
|
Can I please get help.As I am getting an error ORA-00903 Invalid Table
when I execute the guery in the GetDefaultSQL().
CString CMyebridgeSet::GetDefaultConnect()
{
return _T("ODBC;DSN=om_ebridge");
}
CString CMyebridgeSet::GetDefaultSQL()
{
return _T(" SELECT [SCOTT].[TRANSACTION_MASTER].[TRANSACTION_CODE],[SCOTT].[TRANSACTION_MASTER].[VEHICLE_NO],[SCOTT].[TRANSACTION_MASTER].[OPERATING_MODE],")
_T("[SCOTT].[TRANSPORTER_MASTER].[transporter_name],[SCOTT].[SUPPLIER_MASTER].[SUPPLIER_NAME],")
_T("[SCOTT].[PRODUCT_MASTER].[PRODUCT_NAME],[SCOTT].[TRANSACTION_MASTER].[unit],[SCOTT].[TRANSACTION_MASTER].[Gross_Wt],[SCOTT].[TRANSACTION_MASTER].[Gross_WtTime],")
_T("[SCOTT].[TRANSACTION_MASTER].[Tare_Wt],[SCOTT].[TRANSACTION_MASTER].[Tare_WtTime],[SCOTT].[TRANSACTION_MASTER].[CONTAINER1_TAREWT],")
_T("[SCOTT].[TRANSACTION_MASTER].[CONTAINER2_TAREWT] ,[SCOTT].[TRANSACTION_MASTER].[net_Wt],[SCOTT].[TRANSACTION_MASTER].[Challan_no],[SCOTT].[TRANSACTION_MASTER].[Challan_Wt],")
_T("[SCOTT].[TRANSACTION_MASTER].[No_Of_Units],[SCOTT].[TRANSACTION_MASTER].[Calculated_Wt],[SCOTT].[TRANSACTION_MASTER].[Formula1],")
_T("[SCOTT].[TRANSACTION_MASTER].[Formula2],[SCOTT].[TRANSACTION_MASTER].[Formula3],[SCOTT].[TRANSACTION_MASTER].[Formula4],")
_T("[SCOTT].[TRANSACTION_MASTER].[location_code],[SCOTT].[TRANSACTION_MASTER].[field1],[SCOTT].[TRANSACTION_MASTER].[field2],[SCOTT].[TRANSACTION_MASTER].[field3] ")
_T("from [SCOTT].[PRODUCT_MASTER] INNER JOIN [SCOTT].[SUPPLIER_MASTER] INNER JOIN [SCOTT].[TRANSACTION_MASTER]")
_T("ON [SCOTT].[SUPPLIER_MASTER].[SUPPLIER_CODE] =[SCOTT].[TRANSACTION_MASTER].[SUPPLIER_CODE]")
_T("ON [SCOTT].[PRODUCT_MASTER].[PRODUCT_CODE]=[SCOTT].[TRANSACTION_MASTER].[PRODUCT_CODE]")
_T("INNER JOIN [SCOTT].[TRANSPORTER_MASTER] ON [SCOTT].[TRANSPORTER_MASTER].[TRANSPORTER_CODE]=[SCOTT].[TRANSACTION_MASTER].[TRANSPORTER_CODE] ");
}
Awaiting a reply.
Thanks
|
|
|
|
|