ecere/gui/Window: Prevent uninitialized values if base Window methods not overridden...
[sdk] / extras / wia.ec
index d4df737..5b7cb00 100644 (file)
@@ -69,12 +69,12 @@ public:
 
    virtual uint stdcall AddRef()
    {
-      return (uint)InterlockedIncrement(&_refCount);
+      return (uint)InterlockedIncrement((void *)&_refCount);
    }
 
    virtual uint stdcall Release()
    {
-      uint cRef = InterlockedDecrement(&_refCount);
+      uint cRef = InterlockedDecrement((void *)&_refCount);
       if(cRef == 0)
          delete this;
       return cRef;
@@ -97,7 +97,7 @@ class WiaDataCallback : MSCOM_IUnknown
       return MSCOM_IUnknown::QueryInterface(iid, ppvObj);
    }
 
-   virtual uint stdcall BandedDataCallback(uint lReason, uint lStatus, uint lPercentComplete, uint lOffset, uint lLength, 
+   virtual uint stdcall BandedDataCallback(uint lReason, uint lStatus, uint lPercentComplete, uint lOffset, uint lLength,
       uint lReserved, uint lResLength, byte * pbBuffer);
 };
 
@@ -114,7 +114,7 @@ class WiaDataTransfer
 class WiaPropertyStorage
 {
    IWiaPropertyStorage *pWiaPropertyStorage;
-   
+
    bool ReadLong(const PROPSPEC *pPropSpec, uint *plResult)
    {
       bool result = true;
@@ -166,7 +166,7 @@ class WiaPropertyStorage
 }
 
 class ScanningProgress : Window
-{  
+{
    autoCreate = false;
    text = "Scanning in progress. Please wait.";
    borderStyle = fixed;
@@ -182,7 +182,7 @@ class MyWiaDataCallback : WiaDataCallback
 {
    TempFile f { };
 
-   uint stdcall BandedDataCallback(uint lReason, uint lStatus, uint lPercentComplete, uint lOffset, uint lLength, 
+   uint stdcall BandedDataCallback(uint lReason, uint lStatus, uint lPercentComplete, uint lOffset, uint lLength,
       uint lReserved, uint lResLength, byte * pbBuffer)
    {
       switch(lReason)
@@ -219,7 +219,7 @@ class WiaItem
 {
    IWiaItem *pWiaItem;
 
-   HRESULT DeviceDlg(HWND hWndParent, uint lFlags, uint lIntent, int * count, void * images)
+   HRESULT DeviceDlg(HWND hWndParent, uint lFlags, uint lIntent, LONG * count, void * images)
    {
       return (HRESULT)IWiaItem_DeviceDlg(pWiaItem, hWndParent, lFlags, lIntent, count, images);
    }
@@ -268,7 +268,7 @@ public:
    {
       List<Bitmap> result = null;
       IWiaItem ** ppIWiaItem;
-      int count;
+      LONG count;
       Window window = ((GuiApplication)__thisModule.application).desktop.activeChild;
       if(window) window = window.rootWindow;
 
@@ -286,17 +286,17 @@ public:
             GET_STIDEVICE_TYPE(nDevType) == StiDeviceTypeScanner)
          {
             PROPSPEC specDocumentHandlingSelect;
-            LONG nDocumentHandlingSelect;
+            uint nDocumentHandlingSelect;
 
             specDocumentHandlingSelect.ulKind = PRSPEC_PROPID;
             specDocumentHandlingSelect.propid = WIA_DPS_DOCUMENT_HANDLING_SELECT;
 
             if(scannerProp.ReadLong(&specDocumentHandlingSelect, &nDocumentHandlingSelect) &&
-               nDocumentHandlingSelect & FEEDER)
+               (nDocumentHandlingSelect & FEEDER))
             {
                PROPSPEC specPages;
                PROPVARIANT varPages;
-                    
+
                specPages.ulKind = PRSPEC_PROPID;
                specPages.propid = WIA_DPS_PAGES;
 
@@ -304,12 +304,12 @@ public:
                varPages.lVal = ALL_PAGES;
 
                scannerProp.WriteMultiple(1, &specPages, &varPages, WIA_DPS_FIRST);
-                
+
                PropVariantClear(&varPages);
             }
          }
          delete scannerProp;
-         
+
          nextPage = true;
          while(nextPage)
          {
@@ -336,7 +336,7 @@ public:
                   {
                      GUID guidFormat = WiaImgFmt_BMP;
                      GUID preferredFormat;
-                     String format = "bmp";
+                     const String format = "bmp";
                      PROPSPEC specPreferredFormat;
 
                      specPreferredFormat.ulKind = PRSPEC_PROPID;
@@ -514,7 +514,7 @@ WiaItem GetScanner(bool alwaysAsk)
       Window window = ((GuiApplication)__thisModule.application).desktop.activeChild;
       if(window) window = window.rootWindow;
       if(!IWiaDevMgr_SelectDeviceDlg(devMan.pWiaDevMgr, window ? window.systemHandle : 0,
-         StiDeviceTypeDefault, alwaysAsk ? WIA_SELECT_DEVICE_NODEFAULT : 0, 0, &pItemRoot))
+         StiDeviceTypeScanner /*StiDeviceTypeDefault*/, alwaysAsk ? WIA_SELECT_DEVICE_NODEFAULT : 0, 0, &pItemRoot))
       {
          result = { pWiaItem = pItemRoot };
       }