Autor |
Beitrag |
CarpeDiem
      
Beiträge: 128
WIN XP
Borland C++ 2002, CodeGear C++ 2007, C# (VS 2008)
|
Verfasst: Fr 28.03.08 20:47
Hallo, das Bildschirmschoner-Thema ist zwar schon zur Genüge durchgekaut, aber ich dachte, daß beim Erstellen der *.scr mit folgendem
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51:
| #include <vcl.h> #pragma hdrstop USEFORM("Bildschirmschoner_Startseite.cpp", Form_Startseite); USEFORM("Bildschirmschoner_Einstellungen.cpp", Form_Einstellungen); USEFORM("Bildschirmschoner_DM.cpp", DM); USEFORM("Bildschirmschoner_Vorschau.cpp", Form_Vorschau); WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { try { Application->Initialize(); SetApplicationMainFormOnTaskBar(Application, true); . if (ParamStr(1).UpperCase() == "/S") { Application->CreateForm(__classid(TForm_Startseite), &Form_Startseite); } if (ParamStr(1).UpperCase() == "/C") { Application->CreateForm(__classid(TForm_Einstellungen), &Form_Einstellungen); } if (ParamStr(1).UpperCase() == "/P") { Application->CreateForm(__classid(TForm_Vorschau), &Form_Vorschau); } Application->CreateForm(__classid(TDM), &DM); Application->Run(); } catch (Exception &exception) { Application->ShowException(&exception); } catch (...) { try { throw Exception(""); } catch (Exception &exception) { Application->ShowException(&exception); } } return 0; } |
in C++ immer nur ein Parameter aufgerufen wird. Bei mir tritt folgendes Problem auf (bei Bildschirmschoner-Einstellungen):
1. Bei Auswahl des Bildschirmschoners in der ComboBox wird die "Form_Vorschau" angezeigt
2. Bei Auswahl der Einstellungen wird wieder die "Form_Vorschau" angezeigt
3. Bei Auswahl der Vorschau wird zuerst "Form_Startseite" und dann "Form_Vorschau" angezeigt
Weiß einer warum? Wenn ich ShowMessage(ParamStr(1)); nach SetApplicationMainFormOnTaskBar(Application, true); eintrage, dann wird mein Problem bestätigt (Bei 1. wird "/p", bei 2. wird "/p" und bei 3. wird zuerst "/s" und dann "/p" angezeigt)
_________________ Stefan - Carpe Diem
Es ist keine Schande zu fallen, eine Schande ist nur nicht wieder aufzustehen
|
|
CarpeDiem 
      
Beiträge: 128
WIN XP
Borland C++ 2002, CodeGear C++ 2007, C# (VS 2008)
|
Verfasst: So 30.03.08 08:12
Hallo, wollte nochmals fragen, ob einer vielleicht eine Idee hat? Danke.
_________________ Stefan - Carpe Diem
Es ist keine Schande zu fallen, eine Schande ist nur nicht wieder aufzustehen
|
|
CarpeDiem 
      
Beiträge: 128
WIN XP
Borland C++ 2002, CodeGear C++ 2007, C# (VS 2008)
|
Verfasst: Mo 31.03.08 20:02
Titel: Problem gelöst
Hallo Leute, Problem ist gelöst. Hier der Quelltext für die Main. 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105:
| #include <vcl.h> #include "stdio.h" #pragma hdrstop USEFORM("Bildschirmschoner_Startseite.cpp", Form_Startseite); USEFORM("Bildschirmschoner_Einstellungen.cpp", Form_Einstellungen); USEFORM("Bildschirmschoner_Vorschau.cpp", Form_Vorschau); WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { try { if (ParamStr(1).UpperCase().SubString(1,2) == "/S") { Application->Initialize(); Application->CreateForm(__classid(TForm_Startseite), &Form_Startseite); Application->Run(); return 0; }
if (ParamStr(1).UpperCase().SubString(1,2) == "/C") { Application->Initialize(); Application->CreateForm(__classid(TForm_Einstellungen), &Form_Einstellungen); Application->Run(); return 0; }
if (ParamStr(1).UpperCase().SubString(1,2) == "/P") { Graphics::TBitmap* Bitmap = new Graphics::TBitmap(); TCanvas *PreCanvas = new TCanvas; TRect MyRect; HWND HPre; AnsiString szPara; AnsiString sBitmap;
sBitmap.SetLength(MAX_PATH); sBitmap.SetLength(GetSystemDirectory(sBitmap.c_str(),sBitmap.Length())); sBitmap += "\\Peace.bmp"; Bitmap->LoadFromFile(sBitmap);
szPara = ParamStr(2);
if (szPara == "") { MessageBox(NULL,szPara.c_str(),"Vorschaufenster - Kein Übergabeparameter 2", MB_OK ); return 0; }
sscanf(__argv[2], "%d", &HPre ); do { Application->ProcessMessages(); } while ( IsWindowVisible( HPre ) == 0 );
PreCanvas->Handle = GetDC( HPre ); if (PreCanvas->Handle == NULL) MessageBox( NULL, "Meldung","Handle", MB_OK );
GetClientRect( HPre, &MyRect ); do { PreCanvas->StretchDraw(MyRect, Bitmap); Application->ProcessMessages(); } while(IsWindowVisible(HPre) != 0 );
delete PreCanvas; delete Bitmap; return 0;
}
} catch (Exception &exception) { Application->ShowException(&exception); } catch (...) { try { throw Exception(""); } catch (Exception &exception) { Application->ShowException(&exception); } } return 0; }
| Das einzige Problem, das ich jetzt noch habe, ist, daß bei geöffneten "Eigenschaften von Datum und Zeit"-Fenster mein System in einen Zustand kommt, in dem nur noch der Desktop ohne Icons und ohne Taskleiste angezeigt wird und nach Maus-Klick sich abmeldet. Vielleicht weiß da jemand was dagegen?? 
_________________ Stefan - Carpe Diem
Es ist keine Schande zu fallen, eine Schande ist nur nicht wieder aufzustehen
|
|
|