-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExtensionSample.cpp
More file actions
796 lines (691 loc) · 20.7 KB
/
ExtensionSample.cpp
File metadata and controls
796 lines (691 loc) · 20.7 KB
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
// ExtensionSample.cpp : Defines the initialization routines for the DLL.
//
#include "stdafx.h"
#include "ExtensionSample.h"
#include "ExtensionSampleVersion.h"
#include "MainDialog.h"
#include "ExtensionDerivedConfig.h"
#include "StockComparator.h"
#include "MyMarketSorter.h"
#include "MyMarketSorterFilter.h"
#include "DialogStockPair.h"
#include "DialogSignedPriceValue.h"
#include "SampleDialogSettingCommand.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// The one and only ExtensionSample object
ExtensionSample theApp;
MainDialog* mainDialog = nullptr;
TakionPopupWnd* messageWnd = nullptr;
TakionMessageBox* messageBox = nullptr;
DialogStockPair* stockPairDialog = nullptr;
DialogSignedPriceValue* signedPriceValueDialog = nullptr;
ExtensionDerivedConfig* extensionConfig = nullptr;
MyDialogMarketSorterFilter* marketSorterFilterDialog = nullptr;
//ExtensionDerivedConfig* initialExtensionConfig = nullptr;
//ExtensionDerivedConfig* savedConfig = nullptr;
const char* const configExtension = "ecg";
#ifdef __cplusplus
extern "C"
{
#endif
unsigned int WINAPI GetExtensionCode(){return ClientExtensionDll::validExtensionCode;}
unsigned __int64 WINAPI GetExtensionVersion(){return theApp.GetVersionNum();}
unsigned __int64 WINAPI GetUtilsVersion(){return U_GetModuleVersionNum();}
unsigned __int64 WINAPI GetUtilsHeaderVersion(){return U_VersionStrToNum(UtilsHeaderVersion);}
unsigned __int64 WINAPI GetUtilsGuiVersion(){return UGUI_GetModuleVersionNum();}
unsigned __int64 WINAPI GetUtilsGuiHeaderVersion(){return U_VersionStrToNum(UtilsGuiHeaderVersion);}
unsigned __int64 WINAPI GetTakionUtilsVersion(){return TU_GetModuleVersionNum();}
unsigned __int64 WINAPI GetTakionUtilsHeaderVersion(){return U_VersionStrToNum(TakionUtilsHeaderVersion);}
unsigned __int64 WINAPI GetTakionGuiVersion(){return TGUI_GetModuleVersionNum();}
unsigned __int64 WINAPI GetTakionGuiHeaderVersion(){return U_VersionStrToNum(TakionGuiHeaderVersion);}
unsigned __int64 WINAPI GetTakionDataVersion(){return TD_GetModuleVersionNum();}
unsigned __int64 WINAPI GetTakionDataHeaderVersion(){return U_VersionStrToNum(TakionDataHeaderVersion);}
unsigned __int64 WINAPI GetTakionLogVersion(){return TL_GetModuleVersionNum();}
unsigned __int64 WINAPI GetTakionLogHeaderVersion(){return U_VersionStrToNum(TakionLogHeaderVersion);}
unsigned __int64 WINAPI GetObserverVersion(){return O_GetModuleVersionNum();}
unsigned __int64 WINAPI GetObserverHeaderVersion(){return U_VersionStrToNum(ObserverHeaderVersion);}
//unsigned __int64 WINAPI GetReceiverVersion(){return R_GetModuleVersionNum();}
unsigned __int64 WINAPI GetReceiverHeaderVersion(){return U_VersionStrToNum(ReceiverHeaderVersion);}
bool WINAPI ExtensionIsDebug()
{
#ifdef _DEBUG
return true;
#else
return false;
#endif
}
const char* WINAPI GetTakionExtensionDescription(){return ExtensionSampleDescriptionStr;}//theApp.GetFileDescription().c_str();}
const char* WINAPI GetTakionExtensionProductName(){return ExtensionSampleProductNameStr;}
unsigned __int64 WINAPI GetExtensionBuildDateTime(){return theApp.GetBuildDateTime();}
void WINAPI MessageReport(unsigned char connectionType, const Message* message, bool outgoing)
{
if(mainDialog)mainDialog->AddMessageReport(connectionType, message, outgoing);
}
void WINAPI NextDayStarted()//This function is called first thing when the next day starts. After some actions in Takion you also get a message TMsgNextDayStarted = TM_NEXT_DAY_STARTED
{
if(mainDialog)
{
mainDialog->NextDayStarted();
}
}
void WINAPI LineDoubleClicked()
{
if(mainDialog)
{
mainDialog->Top();
}
}
void WINAPI TradingLocked(bool locked)
{
if(mainDialog)
{
mainDialog->TradingLocked(!TD_IsTradingAllowed());
}
}
void WINAPI TradingDefaultAccountOnly(bool defaultAccountOnly)
{
if(mainDialog)
{
mainDialog->TradingDefaultAccountOnly(TD_IsDefaultOnlyTradingAllowed());
}
}
void WINAPI TradingTestStocksOnly(bool testStocksOnly)
{
if(mainDialog)
{
mainDialog->TradingTestStocksOnly(TD_IsTestOnlyTradingAllowed());
}
}
void WINAPI KeyStrokeAndCommand(unsigned char ascii, unsigned char modifier, bool repeat, const char* commandName, unsigned int extensionCode, unsigned int userExtensionCode)//commandName can be nullptr;
{
switch(extensionCode)
{
case 1:
//Extension Keystroke command
break;
case 0:
//Takion command
break;
default:
//Unknown command
break;
}
}
void WINAPI SymbolEnteredInMmBox(const char* symbol, unsigned char securityType, bool valid, bool fromKeyboard, unsigned int ordinal)
{
}
void WINAPI SecurityRefreshed(const char* symbol, const Security* security, bool wasLoaded, unsigned int ordinal)//security can be nullptr;
{
}
void WINAPI ActiveMmBoxChanged(const char* symbol, const Security* security, bool wasLoaded, unsigned int ordinal)//symbol and security can be nullptr;
{
}
void WINAPI CommandWindowRemoved(unsigned int ordinal)
{
}
void WINAPI LayoutChanged()
{
}
void WINAPI AppActivated(bool applicationActive)
{
if(!applicationActive && mainDialog)mainDialog->OnMouseForcedReleaseCapture();
}
void WINAPI TakionMoveWindows(int dx, int dy)
{
if(mainDialog)mainDialog->DragWindow(dx, dy);
}
void WINAPI MarketSorterNotifyAdded(HWND hwnd, const char* prefix)
{
}
void WINAPI MarketSorterContents(HWND hwnd, const char* prefix, const Security* security)
{
}
void WINAPI MarketSorterContentsDone(HWND hwnd, const char* prefix)
{
}
void WINAPI MarketSorterNotifyRemoved(HWND hwnd, const char* prefix)
{
}
void WINAPI MarketSorterNotifyPrefixChanged(HWND hwnd, const char* oldPrefix, const char* prefix)
{
}
void WINAPI NotifyMarketSorterSymbol(HWND hwnd, const char* prefix, const Security* security, bool added)
{
}
void WINAPI MarketSorterNotifyAllRowsRemoved(HWND hwnd, const char* prefix)
{
}
void WINAPI MainThreadAvailableDataProcessed()
{
}
bool WINAPI MainThreadIdleState(unsigned int idleCount, bool takionIdleDone)
{
return mainDialog->MainThreadIdleState(idleCount, takionIdleDone);
}
const char* WINAPI GetExtensionInfo()
{
// return theApp.GetInfo().c_str();
TakionSettingDialog* tab = mainDialog->GetCurrentLeaf();
return tab ? tab->GetLabel() : "";
}
//Format: "<1 ifEnabled, or 0 ifDisabled><1 ifChecked, or 0 ifUnchecked><MenuItemText>|..."
//For a separator: just one char |
void AddMenuItemToString(std::string& menuStr, const char* text = nullptr, bool enabled = true, bool checked = false, bool checkable = false)
{
if(text)
{
if(!menuStr.empty())
{
menuStr += '|';
}
menuStr += enabled ? '1' : '0';
menuStr += checked ? '1' : checkable ? '2' : '0';
menuStr += text;
}
else//separator
{
menuStr += '|';
}
}
static bool check = true;
void WINAPI GetTakionExtensionMenu(std::string& menuStr)
{
/*
menuStr += check ?
"10First||11Second|00Third|01Fourth|10Show|10Hide|10Corner":
"10First||10Second|00Third|01Fourth|10Show|10Hide|10Corner";
*/
const bool dlgReady = mainDialog != nullptr && mainDialog->m_hWnd != nullptr;
const bool displayed = dlgReady && mainDialog->isDialogDisplayed();
const bool toShow = dlgReady;// && !displayed;
bool toCorner = dlgReady;
/*
if(toCorner)
{
const CRect& screenRect = mainDialog->GetScreenRect();
const CRect& dialogRect = mainDialog->GetDialogFrameRect();
if(screenRect.left == dialogRect.left && screenRect.top == dialogRect.top)
{
toCorner = false;
}
}
*/
AddMenuItemToString(menuStr, "First", true, false);
AddMenuItemToString(menuStr);
AddMenuItemToString(menuStr, "Second", true, check, true);
AddMenuItemToString(menuStr, "Third", false, false);
AddMenuItemToString(menuStr, "Fourth", false, true);
AddMenuItemToString(menuStr, "Show", toShow);
AddMenuItemToString(menuStr, "Hide", displayed);
AddMenuItemToString(menuStr, "Corner", toCorner);
AddMenuItemToString(menuStr, "PopupWnd");
AddMenuItemToString(menuStr, "MessageBox");
}
void WINAPI ExecuteTakionCommand(unsigned short commandId, CWnd* takionExtensionWindow)
{
switch(commandId)
{
case 0:
{
TakionMessageBox mb(TGUI_GetTakionMainWnd());
mb.AddMessage("Command 1 executed");
mb.DisplayModal(takionExtensionWindow, "Extension Command", MB_OK|MB_ICONINFORMATION);//, RGB(0, 0, 128), RGB(255, 255, 255));
//FILE* fp = fopen( "Log.txt", "w" );
/*
TakionIterator* iterator = TD_CreateEquityIterator();
TD_LockEquityStorage();
iterator->Reset();
std::string info;
char buf[33];
Security* security;
while( security = TD_GetNextEquity( iterator ) )
{
info = security->GetSymbol();
info += ' ';
info += U_UnsignedNumberToStrWithCommas(security->GetYesterdaysVolume(), buf, sizeof(buf));
//fprintf_s( fp, "%s\t%s\n", security->GetSymbol(), volStr );
TD_Log(info.c_str(), "YVol");
}
TD_UnlockEquityStorage();
delete iterator;
*/
}
break;
case 1:
check = !check;
{
TakionMessageBox mb(TGUI_GetTakionMainWnd());
mb.AddMessage(check ? "Command 2 checked" : "Command 2 unchecked");
mb.DisplayModal(takionExtensionWindow, "Extension Command", MB_OK|MB_ICONINFORMATION);//, RGB(0, 0, 128), RGB(255, 255, 255));
}
break;
case 2:
{
TakionMessageBox mb(TGUI_GetTakionMainWnd());
mb.AddMessage("Command 3 executed");
mb.DisplayModal(takionExtensionWindow, "Extension Command", MB_OK|MB_ICONINFORMATION);//, RGB(0, 0, 128), RGB(255, 255, 255));
}
break;
case 3:
{
TakionMessageBox mb(TGUI_GetTakionMainWnd());
mb.AddMessage("Command 4 executed");
mb.DisplayModal(takionExtensionWindow, "Extension Command", MB_OK|MB_ICONINFORMATION);//, RGB(0, 0, 128), RGB(255, 255, 255));
}
break;
case 4:
if(mainDialog)
{
mainDialog->Top();
}
break;
case 5:
if(mainDialog)
{
mainDialog->OnCancel();
}
break;
case 6:
if(mainDialog)
{
mainDialog->Corner();
}
break;
case 7:
if(messageWnd)
{
messageWnd->ClearMessageList(false);
messageWnd->AddMessage("Text", false);
messageWnd->DisplayModeless(mainDialog ? (CWnd*)mainDialog : (CWnd*)TGUI_GetTakionMainWnd(), "TakionExtension", MB_YESNO | MB_ICONQUESTION);
}
break;
case 8:
if(messageBox)
{
messageBox->ClearMessageList(false);
messageBox->AddMessage("Text", false);
messageBox->DisplayModeless(mainDialog ? (CWnd*)mainDialog : (CWnd*)TGUI_GetTakionMainWnd(), "TakionExtension", MB_YESNO | MB_ICONQUESTION);
}
break;
default:
{
TakionMessageBox mb(TGUI_GetTakionMainWnd());
std::string info("Unknown Command ");
char num[33];
info += U_UnsignedNumberToStrNoDecDigits(commandId, num, sizeof(num));
mb.AddMessage(info);
mb.DisplayModal(takionExtensionWindow, "Extension Command", MB_OK|MB_ICONERROR);//, RGB(0, 0, 128), RGB(255, 255, 255));
}
break;
}
}
void WINAPI ExtensionInitialize()
{
if(!mainDialog)
{
const std::string& configPath = theApp.GetConfigFilePath();
// mainDialog = new MainDialog(theApp.GetProductName().c_str(), theApp.GetVersionNum(), configExtension);
mainDialog = new MainDialog(ExtensionSampleProductNameStr, theApp.GetVersionNum(), configExtension);
// mainDialog->AddSettingDialog(new DialogMirror(mainDialog->GetMainWnd(), mainDialog));
extensionConfig = new ExtensionDerivedConfig;
// initialExtensionConfig = new ExtensionDerivedConfig;
extensionConfig->SetFileName(configPath.c_str());
extensionConfig->Serialize(true, configPath.c_str(), theApp.GetVersionStr().c_str(), true, 0);
// savedConfig = (ExtensionDerivedConfig*)extensionConfig->Clone();
mainDialog->SetConfig(extensionConfig);
// mainDialog = new MainDialog();
TakionMainWnd* mainWnd = TGUI_GetTakionMainWnd();//mainDialog->GetMainWnd()
mainDialog->ApplyConfig(0);
mainDialog->CreateModeless(mainWnd);
messageWnd = new TakionPopupWnd(mainWnd, true);
messageWnd->AddCheckBox("CheckBox", true, false, false, false);
messageBox = new TakionMessageBox(mainWnd, true);
messageBox->AddCheckBox("CheckBox", false, true, false, false);
stockPairDialog = new DialogStockPair(mainWnd);
stockPairDialog->CreateModeless(mainWnd);
// stockPairDialog->UpdateSystemRects();
signedPriceValueDialog = new DialogSignedPriceValue(mainWnd);
signedPriceValueDialog->CreateModeless(mainWnd);
}
}
void WINAPI ExtensionTerminate()
{
//Cleanup commands
SampleDialogSettingCommand::CleanupCommands();
//
if(mainDialog)
{
if(messageWnd)
{
if(messageWnd->m_hWnd)
{
messageWnd->DestroyWindow();
// delete messageWnd;//destruction is done in DestroyWindow by the operating system
}
else
{
delete messageWnd;
}
messageWnd = nullptr;
}
if(messageBox)
{
messageBox->DestroyWindow();
delete messageBox;
messageBox = nullptr;
}
if(stockPairDialog)
{
stockPairDialog->DestroyWindow();
delete stockPairDialog;
stockPairDialog = nullptr;
}
if(signedPriceValueDialog)
{
signedPriceValueDialog->DestroyWindow();
delete signedPriceValueDialog;
signedPriceValueDialog = nullptr;
}
if(marketSorterFilterDialog)
{
marketSorterFilterDialog->DestroyWindow();
delete marketSorterFilterDialog;
marketSorterFilterDialog = nullptr;
}
mainDialog->DestroyWindow();
delete mainDialog;
mainDialog = nullptr;
/*
if(extensionConfig)
{
delete extensionConfig;
extensionConfig = nullptr;
}
*/
/*
if(initialExtensionConfig)
{
delete initialExtensionConfig;
initialExtensionConfig = nullptr;
}
if(savedConfig)
{
delete savedConfig;
savedConfig = nullptr;
}
*/
}
}
void WINAPI CurrentAccountSet(Account* account)
{
if(mainDialog)
{
mainDialog->CurrentAccountSet(account);
}
}
void WINAPI OpenLayout()
{
if(mainDialog)
{
mainDialog->OpenDlgLayout();
/*
const std::string& configFile = theApp.GetConfigFilePath();
if(!configFile.empty())
{
TakionMainWnd* mainWnd = TGUI_GetTakionMainWnd();//mainDialog->GetMainWnd()
std::string files("Layout Files (*.");
files += configExtension;
files += ")|*.";
files += configExtension;
files += "|All Files (*.*)|*.*||";
std::string title("Load ");
const std::string& product = theApp.GetProductName();
if(product.empty())
{
title += "Extension";
}
else
{
title += product;
}
title += " Layout";
TakionFileDialog fileDlg(mainWnd, true, configExtension, configFile.c_str(),
OFN_HIDEREADONLY|OFN_ENABLESIZING|OFN_EXPLORER|OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST,
files.c_str(), title.c_str(), mainDialog);
if(fileDlg.DoModal() == IDOK)
{
std::string pathName = fileDlg.GetPathName();
extensionConfig->Update();
unsigned int flags = 0;
extensionConfig->Serialize(true, pathName.c_str(), theApp.GetVersionStr().c_str(), false, flags);
// ApplyConfig(fileDlg.GetFlags(), false);
mainDialog->ApplyConfig(flags);
}
}
*/
}
}
void WINAPI SaveLayout()
{
if(mainDialog)
{
mainDialog->SaveDlgLayout();
}
/*
extensionConfig->Update();
if(*extensionConfig != *savedConfig)
{
const std::string& fileNameStr = extensionConfig->GetOpenFileName();
const char* fileName = fileNameStr.c_str();
unsigned int flags = 0;
extensionConfig->Serialize(false, fileName, theApp.GetVersionStr().c_str(), true, flags);
*savedConfig = *extensionConfig;
}
*/
}
void WINAPI RestoreLayout()
{
if(mainDialog)
{
mainDialog->RestoreDlgLayout();
}
/*
extensionConfig->Update();
if(*extensionConfig != *savedConfig)
{
*extensionConfig = *savedConfig;
unsigned int flags = 0;
mainDialog->ApplyConfig(flags);
}
*/
}
const char* WINAPI GetLayoutFilePath()
{
const std::string& configFile = theApp.GetConfigFilePath();
return configFile.empty() ? nullptr : configFile.c_str();
}
void WINAPI SaveLayoutAs()
{
if(mainDialog)
{
mainDialog->SaveDlgLayoutAs();
/*
const std::string& configFile = theApp.GetConfigFilePath();
if(!configFile.empty())
{
std::string files("Layout Files (*.");
files += configExtension;
files += ")|*.";
files += configExtension;
files += "|All Files (*.*)|*.*||";
std::string title("Save ");
const std::string& product = theApp.GetProductName();
if(product.empty())
{
title += "Extension";
}
else
{
title += product;
}
title += " Layout";
TakionMainWnd* mainWnd = TGUI_GetTakionMainWnd();//mainDialog->GetMainWnd()
TakionFileDialog fileDlg(mainWnd, false, configExtension, configFile.c_str(),
OFN_HIDEREADONLY|OFN_ENABLESIZING|OFN_EXPLORER|OFN_PATHMUSTEXIST|OFN_EXTENSIONDIFFERENT,
files.c_str(), title.c_str(), mainDialog);
if(fileDlg.DoModal() == IDOK)
{
std::string pathName = fileDlg.GetPathName();
extensionConfig->Update();
unsigned int flags = 0;
extensionConfig->Serialize(false, pathName.c_str(), theApp.GetVersionStr().c_str(), true, flags);
*savedConfig = *extensionConfig;
savedConfig->SetFileName(pathName.c_str());
}
}
*/
}
}
CWnd* WINAPI TakionCreateExtensionTool(const char* id, const CBitmap* bitmap, unsigned int workspace, bool pinned)
{
// return m_CreateExtensionToolFunction(id, bitmap, workspace, pinned);
if(!strcmp(id, StockComparator::stockComparatorId))
{
return new StockComparator(bitmap, workspace, pinned);
}
if(!strcmp(id, MyMarketSorter::myMarketSorterId))
{
return new MyMarketSorter(bitmap, workspace, pinned);
}
return nullptr;
}
#ifdef __cplusplus
}
#endif
//
//TODO: If this DLL is dynamically linked against the MFC DLLs,
// any functions exported from this DLL which call into
// MFC must have the AFX_MANAGE_STATE macro added at the
// very beginning of the function.
//
// For example:
//
// extern "C" BOOL PASCAL EXPORT ExportedFunction()
// {
// AFX_MANAGE_STATE(AfxGetStaticModuleState());
// // normal function body here
// }
//
// It is very important that this macro appear in each
// function, prior to any calls into MFC. This means that
// it must appear as the first statement within the
// function, even before any object variable declarations
// as their constructors may generate calls into the MFC
// DLL.
//
// Please see MFC Technical Notes 33 and 58 for additional
// details.
//
// CExtensionSampleApp
/*
BEGIN_MESSAGE_MAP(CExtensionSampleApp, CWinApp)
END_MESSAGE_MAP()
*/
// ExtensionSample construction
ExtensionSample::ExtensionSample():
m_versionNum(0),
m_buildDateTime(U_ConvertStringDateTimeToUInt64(__DATE__, __TIME__))
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
// CExtensionSampleApp initialization
BOOL ExtensionSample::InitInstance()
{
CWinApp::InitInstance();
U_InitializeInstanceInfo(m_hInstance, m_filePathAndName, m_fileDescription, m_platform, m_versionNum, m_versionStr);
// U_QueryVersionResourceValue(m_filePathAndName.c_str(), "ProductName", m_productName);
char path[MAX_PATH];
strcpy_s(path, sizeof(path), m_filePathAndName.c_str());
char* p = strrchr(path, '\\');
if(!p)
{
p = path + strlen(path);
*p = '\0';
}
else
{
*(p + 1) = '\0';
}
m_dllPath = path;
m_configFilePath = m_dllPath;
m_configFilePath += "ExtensionSample.";//ecg";
m_configFilePath += configExtension;
// U_QueryVersionResourceValue(m_filePathAndName.c_str(), "ProductName", m_productName);
/*
std::string configFile;
bool result = GetModuleFileName(theApp.m_hInstance, path, sizeof(path)) > 0 && strlen(path) < sizeof(path);
char path[MAX_PATH];
char absolutePath[MAX_PATH];
char* exeFileName;
DWORD ret = GetFullPathName(path, sizeof(absolutePath), absolutePath, &exeFileName);
if(ret)
{
strcpy_s(path, sizeof(path), absolutePath);
}
if(result)//U_GetModulePath(m_hInstance, path, sizeof(path)))
{
char* p = strrchr(path, '\\');
if(!p)
{
p = path + strlen(path);
*p = '\0';
}
else
{
*(p + 1) = '\0';
}
m_dllPath = path;
}
*/
return TRUE;
}
int ExtensionSample::ExitInstance()
{
int ret = CWinApp::ExitInstance();
return ret;
}
void ExtensionSample::SetInfo(const char* info)
{
TGUI_UpdateExtensionRow(m_hInstance);
/*
if(info)
{
if(strcmp(info, m_info.c_str()))
{
m_info = info;
TGUI_UpdateExtensionRow(m_hInstance);
}
}
else if(!m_info.empty())
{
m_info.clear();
TGUI_UpdateExtensionRow(m_hInstance);
}
*/
}
MyDialogMarketSorterFilter* ExtensionSample::GetMarketSorterFilterDialog()
{
if(!marketSorterFilterDialog)
{
marketSorterFilterDialog = new MyDialogMarketSorterFilter(TGUI_GetTakionMainWnd(), true, nullptr, nullptr);
}
if(!marketSorterFilterDialog->m_hWnd)
{
marketSorterFilterDialog->CreateModeless(TGUI_GetTakionMainWnd());
marketSorterFilterDialog->UpdateSystemRects();
}
return marketSorterFilterDialog;
}