HI and thank you in advance. I am developing a windows mobile application and have encountered some serious problems. First, I was a Visual c++ programmer and in the process of developing my MFC smart device, I realized there is not much offered in c++ to work with database on smart devices. I so badly needed my application to connect to DB ( and all the examples I was getting were in .NET) that i decided to learn .NET, After a few days, I learnt some c# and developed my application that connected very well to DB as I wanted. This application was supposed to be installed on windows mobile devices and be used to make sales in the fields ( e.g by beverage distributors who move around with vehicles). Hurdle number two came when I needed to print a fiscal receipt for a sale posted by my application. From my hardware vendor, he recomended the a fiscal printer called TSL Mobile BT, which is approved in my country (Kenya) and connects to the devices via blue tooth. I was also told that another company has already made an application that connects with the device from a PDA. So I went online http://www.tremol.bg/us/en/products/[^] and downloaded the dll for the gadget. It has a sample C# desktop application. I added the library (ZFPCOMLib)to my application and when I run the application I got this error. COM Object with CLSID '{239FFB-......27AA} cannot be created due to the following error.Class not registered. I googled on how to register a dll in windows mobile and found a solution as using regsvrce.exe, but after I copied it to the emulator but was unable to launch it ( in desktops we use cmd and type regsvr xx.dll) but i dint know if windows mobile has cmd and how to launch it or even how to open RUN command.. (if you are done laughing, lets continue), then I so another shocking forum and someone said that a dll working on Desktop application would not work on windows mobile ( due to the target processor for the dll), but the hardware vendor told me someone else had been able to hack it. Now am stranded, having done a whole desktop operation to manage the inventory for the distributor, and the mobile version doing the sales ( but failing to print fiscal receipts as demanded by the client). Dear programmers, Please guide me on what to do next.. If this goes through I shall consider a small reward to the person who shall help me crack it ( first). Note that my p
kingori
Posts
-
How to register a DLL in Windows Mobile -
A connection to Sqlce using c++ for a smart device using ADOHi, so what database can I use with c++, they must have put MFC Smart Device applications development with a reason. Does pocket access work (.cdb)
-
A connection to Sqlce using c++ for a smart device using ADOHi and thank you in advance. As i write this, I have tried to research the internet on database applications for devises running windows mobile or windows CE and to my surprise most examples I find, even msdn itself concentrates on C#.net and VB.net I have been looking for an example on how to do a database a c++ program connecting to sqlce database (.sdf) using ado.net I use VS 2010. I have done the following so far. Have added a common file I found - Ado.h I have installed sql server ce on my emulator, I am using Windows mobile 5.0. I have the following code in my InitInstance() function
CDatabase g_db; m_strConnection = _T("Data Source=\\My Documents\\DB2.sdf"); if(!g_db.Open(m_strConnection)) { AfxMessageBox(_T("Cannot open database")); //return FALSE; }
when i deploy the emulator, this is the error i get, "A problem has occured... please report this to microsoft". Meaning my program crushes and cannot open the DB. the DB2.sdf is saved in the My documents of the emulator. Please assist, I need to know how to successfully connect to the DM. Accept my thanks in advance -
How do i backup a database or table in a dump file (.sql)HI, i need the query to dump a database to or a database table to an sql dump which i can restore with the LOAD DATA INFILE.. command. Thank you in advance.
-
string pointer and int pointerhoo ho, i get your question right, and you have no idea how i struggled with c++ before i coluds understand pointers, thats why they even made java, to eliminate the whole thing about pointers, but the minute you understand the, thats it.. Just know that pointers yes have 2 major refences or usage in c++. It all depends on how you use them, but fact is , they do point to an address in memory, not the actual data. Your question goes like this, if i say int my_number = 5; int* my_pointer = # the output ; cout << my_pointer ; displays an address, sth like 45542945; if i output ; cout << *my_pointer; then i get the number 5; this is to say, my_pointer, is a memory (RAM) address, and the value in *my_pointer is the value 5; if when used with a character / string, the pointer will refence the address of the first character, then when i say char* my_ptr = "this is a string"; cout <<my_ptr. my pointer being an address of the 1st character, then i shoudl see the address output, not the whole string. but thats not the case, why??? was that the question. okay, one point you have right, the other point you are missing is that, a pointer when used to refence an array, it points to the first element of the array. why do you think this is correct; int nums[3] = {11,21,31}; int* nums_ptr = nums; cout<< nums_ptr[0] ; because when you do point an array (a string is a also an array), you can copy the whole array into a pointer one time. and yuo know that an array is placed in (contigous) continuous memory locations, i.e. if 11 is in addres x, then 21 is in x+1, and 31. so for integers if you want the third element of the array in that has been copied to an pointer, if you say nums_ptr[2], you wont get the address of the 3rd element, you'll get the value. but again for integers if you say cout<<nums_ptr; you wont get all the elements of the array displayed on the screen like 112131, no, you get the address. thats the only differents with characters since, an array of characters is treated like a string.. displaying the pointer wont display the adress of the fisrt character but the whole string. try play with pointers, that's the weak and stronghold with c++, in that learning is abit confusing but once learnt it gives some crazy flexibility you wont get from any of it's neighbors..
-
Please Help me !!hi , maybe you might not be conversant with threads or multithreading, which simply means, having many threads running at the same time, in one program, so am going to easily illustrate how you can overcome your problem using just one thread. i advice you place your code for filling the list in a function then you call the function in the Oninitupdate or since you want the list loaded at progream start. this is better and clearer than filling so much code in the oninitUpdate() fiuntion. so this is what we shall do, i hope you can tell the number of items you are putting in the list, Put a progress control , Add a control variable to it, call it "m_ctlProgress" using the wizard. ////////////////////// int nCounter = 0; int nNumberOfRecords = ctlProgress.SetRange(0,nNumberOfRecords ); for { ////////////////////////// Your filling code here ///////////////////////// nCounter++; m_ctlProgress.SetPos(nCounter); } then call the function from wherever, from the Oninit.. or when a certain button is clicked, etc
-
combo boxHi, i got a question, and av strugled enough tyms tryn to have this. you know the way when you click on a combo box's arrow at the end a small list shows again with two other arrows that enable you to scroll the small list, i have tried make combo box without scroll bars, but this still gives me the short list, that can only be scrollled with the keyboards up down arrows. i haven't posted my question yet, sorry for the delay.. this is it, how do i achieve those combo boxes that i see, that shows a very long list, with like 20 or 30 items.no scroll bars. thank you in advance.
-
Animation Control in MFCthis is the easiest control ever use, just add an animate control on a dialog box, add a variable of type CAnimateCtrl. in the OnInitDialog() function call the function Open() and Play(). remember to call function Close() in ua dlg box's OnClose() function or onDestroy() like this. ////////////////////////// m_ctlMyAnimation.Open(_T("C:\\Windows\System32\\migwiz\\progress.avi")); m_ctlMyAnimation.Play(); //////////////////////// remember that this avi shud be some of those simple animation files, not music video or moviz, a good example is that microsoft dog that shows up when yu are searching. ::OnButtonStop() { m_ctlMyAnimation.Stop(); } ::OnClose() { m_ctlMyAnimation.Close(); }
-
Get width and height in pixel of a paper before printing [modified]hi, you need a to use a standard unit to define the size of ua graphic other than using pixels e.g inches, coz if you use pixels , each printer will come with different aspect ratios of the pixel units, and you cud have a printer whose one inch long on paper , is say 100 pixels while on the screen of your computer it could have been 150 pixels making an inch of your image so you end up having a different image on paper . this is what i advise you to do. and i give an example of making some cells and they'll print same way thy appear on screean define 2 variables in the header file of your view call them, int m_nCellWidth and m_nCellHeight; Inside the Draw function of your view put this code. m_nCellWidth = pDC->GetDeviceCaps(LOGPIXELSX); m_nCellHeight = pDC->GetDeviceCaps(LOGPIXELSY)/4; what does this function do before assingning some values in your integers. the Function GetDeviceCaps(PARAMS) is a member of pDC (screen or printer) and it returns (depending on parameters) the number of pixels of the Devise context that make up one inch of y-axis (if PARAMS are LOGPIXELSY) or x - axis (if PARAMS are LOGPIXELSX); now you have a unit that is equivalent to a quarter of an inch on y axis (vertical axis) of any printer m_nCellHeight and another m_nCellWidth representing a an inch on x-axis. it's not a must you divide by 4, to make a quarter inch unit for y-axis, you can still use a full inch, it's olnly that the example i want to give you requires a quarter of an inch unit. now put this code. ////////////////////////////////////// int nMyPageHeight = (20 * m_nCellHeight ); // about 20 cells int nMyPageWidth = (5* m_nCellWidth); // about 5 columns for (int i=0; i { // draw horizantal lines from left to right pDC->MoveTo(0,i * m_nCellHeight); pDC->LineTo(nMyPageWidth ,i * m_nCellHeight); } for (int j=0; j { // draw vertical lines top of page to bottom pDC->MoveTo(j *m_nCellWidth ,0); pDC->LineTo(j *m_nCellWidth ,nMyPageHeight); } //////////////////////////////////////////////////// now try to print your image and see what happens. note that the print function calls the OnDraw() function of the view class and passes pDC, pointer to the printer, so if you call this code in another function other than the draw, make sure you call the Function from the OnDraw() function and pass pDC to it, dont use CClientDC(),
-
Memory allocation help.try HeapAlloc
-
upper drawing layerYes you get a flickering problem coz when you call OnPaint() or Invalidate() you are redrawing the whole window. try this Create your function e.g MyDrawing(int x,int y) { CClientDC dc(this); dc.SetTextColor(RGB(0,0,255)); dc.TextOut(x,y,"my text"); } in you Mouse Move Handler { .... MyDrawing(point.x,point.y); } then play around with rectangles
-
Link Problem...hi try this in project settings, select using MFC dlls in one of the combo boxes.
-
how can you stop the proceses runin in the comp or task mgr ..Hi every one; am tryin to make an antivirus, and i am having a problem tryin to figure out how i can stop a process that is running, i.e how can i make the AV to stop a virus process thats running, Also if you know how i can clean the registry with the AV you can assist me. THANX in advance
-
help mehi; most likely you have declared an array without indicating its size e.g long m_lStudents[]; if thats the case then give it size;
-
how do you get the index of a row in a list controlhi every one am stuck, this is what i want to do. i have a Report styled list control with 5 columns and i have a double clicked event handler for the list control; so i want to get the index of a row once i double click on it, which list control function do i interrogate, e.g if it was a list box , i would do this; CListBox m_Listbx; .... ... int nSel = m_ListBox.GetCurSel(); now in CListCtrl what function is analogous to CListBox's GetCurSel() and how is it used.. thanks;
-
problem with adding and deleting ADO,also needs a link to resourceshi; i new in MFC and i have a problem with adding and deleting but basically i can attribute my problem to lack of proper tutorials on the same. ANy site i try to get tutorials i end up with getting complex stuff posted by Gurus tryiong to implement not the usual basic works that am in need of so i have been tring to understand the whole concept by following one simple code example i have and so in that connection if you know a site i can get real introduction tutorials to ADO in MFC i will appreciate but in the mean time help me get thru this problem at hand(my name is king'ori from kenya); I want to add supplierid (not null primary key) and suppliername(not null) to the SUPPLIERS table (which i have alreaady created); so i have included the adofields.h in my project..,done the ::initialization, the opening() plus i have these functions void MyView:: RefreshSupplier() { if(p_rsSupplier->BOFILE || p_rsSupplierEOFILE) return; m_strSupplierName =(const char*)_bstr_t(FieldValue(p_rsSupplier,"suppliername"); m_lSupplierID = long(FieldValue(p_rsSupplier,"supplierID")); UpdateData(FALSE); } vooid MyView:: UpdateSupplier() { if(p_rsSupplier->BOFILE || p_rsSupplier->EOFILE) retirn; CString strSupplier; long lsupplier; UpgateData(); if(lSupplier != m_lSupplierID) FieldValue(p_rsSupplier,"supplierid",m_lSupplierID); if(strSupplier != m_strSupplierName) FieldValue(p_rsSupplier,"suppliername",m_strSuppliername); } void MyView::BlankSupplier() { m_lSupplierID = 0; m_strSupplierName = _T(" "); } problem comes i dont understand the adding flow,- for instance why do you have to blank the recordset? what comes first p_rsSupplier->Addnew() or is it UpdateSupplier() and why; this is not working void MyView::AddSupplier() { BlankSupplier(); //why this and my fields are not null? p_rsSupplier->AddNew(); UpdateData(); p_rsSupplier->PutCollect(_variant_t("Suppliername",_variant((LPCTSTR)m_strName); p_rsSupplier->PutCollect....suppierID); p_rsSupplier->MoveNext(); RefreshSupplier(); } void MyView::DeleteSupplier() { if(p_rsSupplier->BOFILE || p_rsSupplier->EOFILE) { if(Warning MSgBx ==YES) { p_rsSupplier->Delete(adAffectCurrent); p_rsSupplier->MovePrevious(); RefreshSupplier(); }
-
problem with adding and deleting ADO,also needs resourceshi; i new in MFC and i have a problem with adding and deleting but basically i can attribute my problem to lack of proper tutorials on the same. ANy site i try to get tutorials i end up with getting complex stuff posted by Gurus tryiong to implement not the usual basic works that am in need of so i have been tring to understand the whole concept by following one simple code example i have and so in that connection if you know a site i can get real introduction tutorials to ADO in MFC i will appreciate but in the mean time help me get thru this problem at hand(my name is king'ori from kenya); I want to add supplierid (not null primary key) and suppliername(not null) to the SUPPLIERS table (which i have alreaady created); so i have included the adofields.h in my project..,done the ::initialization, the opening() plus i have these functions void MyView:: RefreshSupplier() { if(p_rsSupplier->BOFILE || p_rsSupplierEOFILE) return; m_strSupplierName =(const char*)_bstr_t(FieldValue(p_rsSupplier,"suppliername"); m_lSupplierID = long(FieldValue(p_rsSupplier,"supplierID")); UpdateData(FALSE); } vooid MyView:: UpdateSupplier() { if(p_rsSupplier->BOFILE || p_rsSupplier->EOFILE) retirn; CString strSupplier; long lsupplier; UpgateData(); if(lSupplier != m_lSupplierID) FieldValue(p_rsSupplier,"supplierid",m_lSupplierID); if(strSupplier != m_strSupplierName) FieldValue(p_rsSupplier,"suppliername",m_strSuppliername); } void MyView::BlankSupplier() { m_lSupplierID = 0; m_strSupplierName = _T(" "); } problem comes i dont understand the adding flow,- for instance why do you have to blank the recordset? what comes first p_rsSupplier->Addnew() or is it UpdateSupplier() and why; this is not working void MyView::AddSupplier() { BlankSupplier(); //why this and my fields are not null? p_rsSupplier->AddNew(); UpdateData(); p_rsSupplier->PutCollect(_variant_t("Suppliername",_variant((LPCTSTR)m_strName); p_rsSupplier->PutCollect....suppierID); p_rsSupplier->MoveNext(); RefreshSupplier(); } void MyView::DeleteSupplier() { if(p_rsSupplier->BOFILE || p_rsSupplier->EOFILE) { if(Warning MSgBx ==YES) { p_rsSupplier->Delete(adAffectCurrent); p_rsSupplier->MovePrevious(); RefreshSupplier(); }
-
how do you package an MFC programhi i am new to MFC and i have a small (my first ) program-sort of schedular program .I want to package it and deploy it to my friends so that they can run 'setup' and install it in their PCs. is it much work to do that and how is it done? thanks in advance
-
;how do you haddle OnAplly() for many property sheets [modified]hi since when Apply is clicked in a property sheet, its OnAplly() calls updateData() for the active page and initializes an ELLPROP structure with the settings, then sends a message to the main window containing the structures address.The main Window forwads the massage to the view (so far so good),the view copies the property values to its own data members (comes the problem) -suppopse i have many property sheets,each one will have an OnApply() that will fill the ELLPROP Structure with its own values, the mainframe will handle OnApply Once like this LRESULT CMainFrame::OnAplly(WPARAM wParam,LPARAM lParam) { m_wndView.SendMessage(WM_USER_APPLY,wParam,lParam); return 0; } then the view also will handle it once ..view::OnAplly(WPARAM wParam,LPARAM lParam) { ELLPROP* pep = (ELLPROP*)lParam; // my question what do i do here (if am supposed to do it only here) if i have multiple property sheets // :confused:lemmi give an example i may think of using proprty sheets insead of very many dialog boxes to write a simple school management program. so one property sheet be for registration (first page studets reg, 2nd page staff reg,3rd page, members reg ..), another property sheet will be for finance (1st page setting the fees charges,2nd page payment of fees, 3rd page payment os salaries and wages to workers, 4th page payment of bills ..) know i want each to update a database using ADO so each property page will have to open an appropriate recordset and do that(i havent tried the database part and know whether it will bring problems too),what i have tried is to have all the input values sent to the view so that i can display them in the client area and i dont know how the view's member variables will copy all these values that are coming from different property sheets and each sending an ELLPROP structure..(should i have some kind of control to know that this structure is from the finance sheet so just copy the finance deatils and leave the registration details- and if so how do i control that) ....... ..... } am new to MFC (4 mths know) so please if you can give me more deatils i'll rilly appreciate,thanks.:laugh: i h -- modified at 2:28 Monday 13th August, 2007